diff --git a/__tests__/adbClient/getProp.ts b/__tests__/adbClient/getProp.ts index 5fb66bbc..a61bcdd9 100644 --- a/__tests__/adbClient/getProp.ts +++ b/__tests__/adbClient/getProp.ts @@ -106,7 +106,7 @@ describe('Gep prop tests', () => { const port = await adbMock.start(); const adb = new Client({ noAutoStart: true, port }); const result = await adb.getProp('serial', 'prop'); - expect(result).toEqual(date); + expect(result).toEqual(date.toISOString()); } finally { await adbMock.end(); } diff --git a/__tests__/adbClient/getSetting.ts b/__tests__/adbClient/getSetting.ts index 0eca6612..39302afc 100644 --- a/__tests__/adbClient/getSetting.ts +++ b/__tests__/adbClient/getSetting.ts @@ -106,7 +106,7 @@ describe('Get setting OKAY tests', () => { const port = await adbMock.start(); const adb = new Client({ noAutoStart: true, port }); const result = await adb.getSetting('serial', 'system', 'prop'); - expect(result).toEqual(date); + expect(result).toEqual(date.toISOString()); } finally { await adbMock.end(); } diff --git a/__tests__/adbClient/listProperties.ts b/__tests__/adbClient/listProperties.ts index 6d03da93..8e217011 100644 --- a/__tests__/adbClient/listProperties.ts +++ b/__tests__/adbClient/listProperties.ts @@ -9,13 +9,19 @@ describe('List properties', () => { { cmd: 'shell:getprop', res: { - value: `[one]: [1] + value: `[one]: [int] +[two]: [string] +[three]: [bool] +[four]: [bool] +[five]: [string] +[six]: [string] +[one]: [1] [two]: [two] [three]: [false] [four]: [true] [five]: [null] [six]: [] -[seven]: [Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)]`, +`, raw: true } } @@ -30,14 +36,8 @@ describe('List properties', () => { ['two', 'two'], ['three', false], ['four', true], - ['five', null], - ['six', undefined], - [ - 'seven', - new Date( - 'Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)' - ) - ] + ['five', 'null'], + ['six', ''] ]) ); } finally { @@ -56,8 +56,7 @@ describe('List properties', () => { [three]: [false] [four]: [true] [five]: [null] -[six]: [] -[seven]: [Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)]`, +[six]: []`, raw: true } } @@ -105,8 +104,7 @@ describe('List properties', () => { [three]: [false] [four]: [true] [five]: [null] -[six]: [] -[seven]: [Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)]`, +[six]: []`, raw: true } } diff --git a/__tests__/adbClient/listSettings.ts b/__tests__/adbClient/listSettings.ts index 86c430b6..9b3ca606 100644 --- a/__tests__/adbClient/listSettings.ts +++ b/__tests__/adbClient/listSettings.ts @@ -15,8 +15,7 @@ two="two" three=false four=true five=null -six= -seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, +six=`, raw: true } } @@ -32,13 +31,7 @@ seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, ['three', false], ['four', true], ['five', null], - ['six', undefined], - [ - 'seven', - new Date( - 'Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)' - ) - ] + ['six', undefined] ]) ); } finally { @@ -75,8 +68,7 @@ seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, three=false four=true five=null - six= - seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, + six=`, raw: true } } @@ -123,8 +115,7 @@ seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, three=false four=true five=null - six= - seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, + six=`, raw: true } } diff --git a/__tests__/device/listProperties.ts b/__tests__/device/listProperties.ts index e1cbbeb3..18cd7a8c 100644 --- a/__tests__/device/listProperties.ts +++ b/__tests__/device/listProperties.ts @@ -10,13 +10,19 @@ describe('List properties tests', () => { { cmd: 'shell:getprop', res: { - value: `[one]: [1] + value: `[one]: [int] +[two]: [string] +[three]: [bool] +[four]: [bool] +[five]: [string] +[six]: [string] +[one]: [1] [two]: [two] [three]: [false] [four]: [true] [five]: [null] [six]: [] -[seven]: [Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)]`, +`, raw: true } } @@ -40,14 +46,8 @@ describe('List properties tests', () => { ['two', 'two'], ['three', false], ['four', true], - ['five', null], - ['six', undefined], - [ - 'seven', - new Date( - 'Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)' - ) - ] + ['five', 'null'], + ['six', ''] ]) ); } finally { diff --git a/__tests__/device/listSettings.ts b/__tests__/device/listSettings.ts index 5b01df12..4aed8733 100644 --- a/__tests__/device/listSettings.ts +++ b/__tests__/device/listSettings.ts @@ -14,8 +14,7 @@ two="two" three=false four=true five=null -six= -seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, +six=`, raw: true } } @@ -30,13 +29,7 @@ seven=Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)`, ['three', false], ['four', true], ['five', null], - ['six', undefined], - [ - 'seven', - new Date( - 'Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)' - ) - ] + ['six', undefined] ]) ); } finally { diff --git a/__tests__/util.ts b/__tests__/util.ts index 35a631d4..19a21691 100644 --- a/__tests__/util.ts +++ b/__tests__/util.ts @@ -91,17 +91,6 @@ describe('String to type', () => { const result = stringToType('[]'); expect(result).toBe('[]'); }); - - it('Cast string date as Date', () => { - const result = stringToType('Mon Dec 20 15:05:47 UTC 2021'); - expect(result).toEqual(new Date('Mon Dec 20 15:05:47 UTC 2021')); - }); - - it('Cast iso date as Date', () => { - const date = new Date(); - const result = stringToType(date.toISOString()); - expect(result).toEqual(date); - }); }); describe('Parse primitive type', () => { @@ -125,8 +114,7 @@ describe('Find matches', () => { [four]: [true] [five]: [null] [six]: [[]] -[seven]: [Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)] -[eight]: []`, +[seven]: []`, /^\[([\s\S]*?)\]: \[([\s\S]*?)\]?$/gm ); expect(result).toEqual([ @@ -136,11 +124,7 @@ describe('Find matches', () => { ['four', 'true'], ['five', 'null'], ['six', '[]'], - [ - 'seven', - 'Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)' - ], - ['eight', ''] + ['seven', ''] ]); }); @@ -152,8 +136,7 @@ describe('Find matches', () => { [four]: [true] [five]: [null] [six]: [[]] -[seven]: [Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)] -[eight]: []`, +[seven]: []`, /^\[([\s\S]*?)\]: \[([\s\S]*?)\]?$/gm, 'map' ); @@ -165,13 +148,7 @@ describe('Find matches', () => { ['four', true], ['five', null], ['six', '[]'], - [ - 'seven', - new Date( - 'Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)' - ) - ], - ['eight', undefined] + ['seven', undefined] ]) ); }); @@ -184,8 +161,7 @@ describe('Find matches', () => { [four]: [true] [five]: [null] [six]: [[]] -[seven]: [Sun Jul 17 2022 21:11:48 GMT+0200 (Central European Summer Time)] -[eight]: []`, +[seven]: []`, /^\[([\s\S]*?)\]: \[([\s\S]*?)\]?$/gm, 'list' ); @@ -196,8 +172,7 @@ describe('Find matches', () => { 'four', 'five', 'six', - 'seven', - 'eight' + 'seven' ]); }); });