1- import { expect } from 'chai ' ;
1+ import assert from 'node:assert/strict ' ;
22import { Devicectl } from '../../lib/devicectl' ;
33import { appUrlToFilesystemPath , escapeProcessFilterValue } from '../../lib/mixins/process' ;
4+ import { describe , it , beforeEach } from 'node:test' ;
45
56describe ( 'Devicectl' , function ( ) {
67 let devicectl : Devicectl ;
@@ -11,120 +12,124 @@ describe('Devicectl', function () {
1112
1213 describe ( 'constructor' , function ( ) {
1314 it ( 'should create a Devicectl instance with the provided UDID and default logger' , function ( ) {
14- expect ( devicectl . udid ) . to . equal ( 'test-device-udid' ) ;
15+ assert . strictEqual ( devicectl . udid , 'test-device-udid' ) ;
1516 } ) ;
1617
1718 it ( 'should allow disabling non-root sudo execution in constructor options' , function ( ) {
1819 const localDevicectl = new Devicectl ( 'test-device-udid' , { preferNonRootWhenSudo : false } ) ;
19- expect ( ( localDevicectl as any ) . preferNonRootWhenSudo ) . to . equal ( false ) ;
20+ assert . strictEqual ( ( localDevicectl as any ) . preferNonRootWhenSudo , false ) ;
2021 } ) ;
2122 } ) ;
2223
2324 describe ( 'sudo behavior' , function ( ) {
2425 it ( 'should cache sudo user identity when available' , function ( ) {
2526 const localDevicectl = new Devicectl ( 'test-device-udid' ) ;
26- expect (
27+ assert . strictEqual (
2728 ( localDevicectl as any ) . sudoUser === null || ! ! ( localDevicectl as any ) . sudoUser ,
28- ) . to . equal ( true ) ;
29+ true ,
30+ ) ;
2931 } ) ;
3032
3133 it ( 'should keep constructor default for runAsNonRootWhenSudo behavior' , function ( ) {
32- expect ( ( devicectl as any ) . preferNonRootWhenSudo ) . to . equal ( true ) ;
34+ assert . strictEqual ( ( devicectl as any ) . preferNonRootWhenSudo , true ) ;
3335 } ) ;
3436 } ) ;
3537
3638 describe ( 'execute' , function ( ) {
3739 it ( 'should throw an error when command execution fails' , async function ( ) {
3840 // This test would need to be mocked in a real implementation
3941 // For now, we'll just test that the method exists
40- expect ( devicectl . execute ) . to . be . a ( 'function' ) ;
42+ assert . strictEqual ( typeof devicectl . execute , 'function' ) ;
4143 } ) ;
4244 } ) ;
4345
4446 describe ( 'sendMemoryWarning' , function ( ) {
4547 it ( 'should be a function' , function ( ) {
46- expect ( devicectl . sendMemoryWarning ) . to . be . a ( 'function' ) ;
48+ assert . strictEqual ( typeof devicectl . sendMemoryWarning , 'function' ) ;
4749 } ) ;
4850 } ) ;
4951
5052 describe ( 'listProcesses' , function ( ) {
5153 it ( 'should be a function' , function ( ) {
52- expect ( devicectl . listProcesses ) . to . be . a ( 'function' ) ;
54+ assert . strictEqual ( typeof devicectl . listProcesses , 'function' ) ;
5355 } ) ;
5456 } ) ;
5557
5658 describe ( 'listFiles' , function ( ) {
5759 it ( 'should be a function' , function ( ) {
58- expect ( devicectl . listFiles ) . to . be . a ( 'function' ) ;
60+ assert . strictEqual ( typeof devicectl . listFiles , 'function' ) ;
5961 } ) ;
6062 } ) ;
6163
6264 describe ( 'pullFile' , function ( ) {
6365 it ( 'should be a function' , function ( ) {
64- expect ( devicectl . pullFile ) . to . be . a ( 'function' ) ;
66+ assert . strictEqual ( typeof devicectl . pullFile , 'function' ) ;
6567 } ) ;
6668 } ) ;
6769
6870 describe ( 'sendSignalToProcess' , function ( ) {
6971 it ( 'should be a function' , function ( ) {
70- expect ( devicectl . sendSignalToProcess ) . to . be . a ( 'function' ) ;
72+ assert . strictEqual ( typeof devicectl . sendSignalToProcess , 'function' ) ;
7173 } ) ;
7274 } ) ;
7375
7476 describe ( 'listApps' , function ( ) {
7577 it ( 'should be a function' , function ( ) {
76- expect ( devicectl . listApps ) . to . be . a ( 'function' ) ;
78+ assert . strictEqual ( typeof devicectl . listApps , 'function' ) ;
7779 } ) ;
7880 } ) ;
7981
8082 describe ( 'launchApp' , function ( ) {
8183 it ( 'should be a function' , function ( ) {
82- expect ( devicectl . launchApp ) . to . be . a ( 'function' ) ;
84+ assert . strictEqual ( typeof devicectl . launchApp , 'function' ) ;
8385 } ) ;
8486 } ) ;
8587
8688 describe ( 'terminateApp' , function ( ) {
8789 it ( 'should be a function' , function ( ) {
88- expect ( devicectl . terminateApp ) . to . be . a ( 'function' ) ;
90+ assert . strictEqual ( typeof devicectl . terminateApp , 'function' ) ;
8991 } ) ;
9092
9193 describe ( 'appUrlToFilesystemPath' , function ( ) {
9294 it ( 'should strip the file:// prefix' , function ( ) {
93- expect ( appUrlToFilesystemPath ( 'file:///path/to/App.app' ) ) . to . equal ( '/path/to/App.app' ) ;
95+ assert . strictEqual ( appUrlToFilesystemPath ( 'file:///path/to/App.app' ) , '/path/to/App.app' ) ;
9496 } ) ;
9597
9698 it ( 'should strip a trailing slash' , function ( ) {
97- expect ( appUrlToFilesystemPath ( '/path/to/App.app/' ) ) . to . equal ( '/path/to/App.app' ) ;
99+ assert . strictEqual ( appUrlToFilesystemPath ( '/path/to/App.app/' ) , '/path/to/App.app' ) ;
98100 } ) ;
99101
100102 it ( 'should strip both the file:// prefix and trailing slash' , function ( ) {
101- expect ( appUrlToFilesystemPath ( 'file:///private/var/App.app/' ) ) . to . equal (
103+ assert . strictEqual (
104+ appUrlToFilesystemPath ( 'file:///private/var/App.app/' ) ,
102105 '/private/var/App.app' ,
103106 ) ;
104107 } ) ;
105108
106109 it ( 'should leave paths without a file:// prefix or trailing slash unchanged' , function ( ) {
107- expect ( appUrlToFilesystemPath ( '/path/to/App.app' ) ) . to . equal ( '/path/to/App.app' ) ;
110+ assert . strictEqual ( appUrlToFilesystemPath ( '/path/to/App.app' ) , '/path/to/App.app' ) ;
108111 } ) ;
109112 } ) ;
110113
111114 describe ( 'escapeProcessFilterValue' , function ( ) {
112115 it ( 'should leave values without special characters unchanged' , function ( ) {
113- expect ( escapeProcessFilterValue ( '/path/to/App.app' ) ) . to . equal ( '/path/to/App.app' ) ;
116+ assert . strictEqual ( escapeProcessFilterValue ( '/path/to/App.app' ) , '/path/to/App.app' ) ;
114117 } ) ;
115118
116119 it ( 'should escape backslashes' , function ( ) {
117- expect ( escapeProcessFilterValue ( String . raw `path\with\slashes` ) ) . to . equal (
120+ assert . strictEqual (
121+ escapeProcessFilterValue ( String . raw `path\with\slashes` ) ,
118122 String . raw `path\\with\\slashes` ,
119123 ) ;
120124 } ) ;
121125
122126 it ( 'should escape double quotes' , function ( ) {
123- expect ( escapeProcessFilterValue ( 'path"with"quotes' ) ) . to . equal ( 'path\\"with\\"quotes' ) ;
127+ assert . strictEqual ( escapeProcessFilterValue ( 'path"with"quotes' ) , 'path\\"with\\"quotes' ) ;
124128 } ) ;
125129
126130 it ( 'should escape backslashes and double quotes together' , function ( ) {
127- expect ( escapeProcessFilterValue ( String . raw `path\"mixed` ) ) . to . equal (
131+ assert . strictEqual (
132+ escapeProcessFilterValue ( String . raw `path\"mixed` ) ,
128133 String . raw `path\\\"mixed` ,
129134 ) ;
130135 } ) ;
@@ -133,7 +138,7 @@ describe('Devicectl', function () {
133138
134139 describe ( 'listDevices' , function ( ) {
135140 it ( 'should be a function' , function ( ) {
136- expect ( devicectl . listDevices ) . to . be . a ( 'function' ) ;
141+ assert . strictEqual ( typeof devicectl . listDevices , 'function' ) ;
137142 } ) ;
138143 } ) ;
139144} ) ;
0 commit comments