diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-05-09 01:25:21 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-05-16 00:55:03 +0200 |
commit | cdb4247b8cb2c4c0f04a3360689340a23992be32 (patch) | |
tree | 43eca0f82018d04889a1197a16933d144b028d1b /packages/main/src/infrastructure | |
parent | chore(deps): bump dependencies (diff) | |
download | sophie-cdb4247b8cb2c4c0f04a3360689340a23992be32.tar.gz sophie-cdb4247b8cb2c4c0f04a3360689340a23992be32.tar.zst sophie-cdb4247b8cb2c4c0f04a3360689340a23992be32.zip |
test: prefer jest API instead of jest-each
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/infrastructure')
-rw-r--r-- | packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.spec.ts | 8 | ||||
-rw-r--r-- | packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts | 8 |
2 files changed, 7 insertions, 9 deletions
diff --git a/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.spec.ts b/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.spec.ts index ae10677..dc15d68 100644 --- a/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.spec.ts +++ b/packages/main/src/infrastructure/electron/impl/__tests__/hardenSession.spec.ts | |||
@@ -21,7 +21,7 @@ | |||
21 | import { URL } from 'node:url'; | 21 | import { URL } from 'node:url'; |
22 | 22 | ||
23 | import { jest } from '@jest/globals'; | 23 | import { jest } from '@jest/globals'; |
24 | import { each, fake } from '@sophie/test-utils'; | 24 | import { fake } from '@sophie/test-utils'; |
25 | import type { | 25 | import type { |
26 | OnBeforeRequestListenerDetails, | 26 | OnBeforeRequestListenerDetails, |
27 | PermissionRequestHandlerHandlerDetails, | 27 | PermissionRequestHandlerHandlerDetails, |
@@ -100,7 +100,7 @@ it('should set permission request and before request handlers', () => { | |||
100 | expect(onBeforeRequest).toBeDefined(); | 100 | expect(onBeforeRequest).toBeDefined(); |
101 | }); | 101 | }); |
102 | 102 | ||
103 | each(permissions.map((permission) => [permission])).it( | 103 | it.each(permissions.map((permission) => [permission]))( |
104 | 'should reject %s permission requests', | 104 | 'should reject %s permission requests', |
105 | (permission: Permission) => { | 105 | (permission: Permission) => { |
106 | hardenSession(getFakeResources(false), false, fakeSession); | 106 | hardenSession(getFakeResources(false), false, fakeSession); |
@@ -114,7 +114,7 @@ each(permissions.map((permission) => [permission])).it( | |||
114 | }, | 114 | }, |
115 | ); | 115 | ); |
116 | 116 | ||
117 | each([ | 117 | it.each([ |
118 | [ | 118 | [ |
119 | false, | 119 | false, |
120 | 'GET', | 120 | 'GET', |
@@ -141,7 +141,7 @@ each([ | |||
141 | [true, 'GET', 'https://clients2.google.com/service/update2/crx/aaaa', false], | 141 | [true, 'GET', 'https://clients2.google.com/service/update2/crx/aaaa', false], |
142 | [true, 'GET', 'https://clients2.googleusercontent.com/crx/aaaa', false], | 142 | [true, 'GET', 'https://clients2.googleusercontent.com/crx/aaaa', false], |
143 | [true, 'GET', 'https://example.com', true], | 143 | [true, 'GET', 'https://example.com', true], |
144 | ]).it( | 144 | ])( |
145 | 'in dev mode: %s the request %s %s should be cancelled: %s', | 145 | 'in dev mode: %s the request %s %s should be cancelled: %s', |
146 | (devMode: boolean, method: string, url: string, cancel: boolean) => { | 146 | (devMode: boolean, method: string, url: string, cancel: boolean) => { |
147 | hardenSession(getFakeResources(devMode), devMode, fakeSession); | 147 | hardenSession(getFakeResources(devMode), devMode, fakeSession); |
diff --git a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts index 635a6b4..8040601 100644 --- a/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts +++ b/packages/main/src/infrastructure/resources/impl/__tests__/getDistResources.spec.ts | |||
@@ -20,8 +20,6 @@ | |||
20 | 20 | ||
21 | import os from 'node:os'; | 21 | import os from 'node:os'; |
22 | 22 | ||
23 | import { each } from '@sophie/test-utils'; | ||
24 | |||
25 | import Resources from '../../Resources'; | 23 | import Resources from '../../Resources'; |
26 | import getDistResources from '../getDistResources'; | 24 | import getDistResources from '../getDistResources'; |
27 | 25 | ||
@@ -52,7 +50,7 @@ const [ | |||
52 | 50 | ||
53 | const fileURLs: [string, string] = [rendererIndexFileURL, rendererRootFileURL]; | 51 | const fileURLs: [string, string] = [rendererIndexFileURL, rendererRootFileURL]; |
54 | 52 | ||
55 | each([ | 53 | describe.each([ |
56 | ['not in dev mode', false, undefined, ...fileURLs], | 54 | ['not in dev mode', false, undefined, ...fileURLs], |
57 | [ | 55 | [ |
58 | 'not in dev mode with VITE_DEV_SERVER_URL set', | 56 | 'not in dev mode with VITE_DEV_SERVER_URL set', |
@@ -68,12 +66,12 @@ each([ | |||
68 | `${defaultDevServerURL}index.html`, | 66 | `${defaultDevServerURL}index.html`, |
69 | defaultDevServerURL, | 67 | defaultDevServerURL, |
70 | ], | 68 | ], |
71 | ]).describe( | 69 | ])( |
72 | 'when %s', | 70 | 'when %s', |
73 | ( | 71 | ( |
74 | _description: string, | 72 | _description: string, |
75 | devMode: boolean, | 73 | devMode: boolean, |
76 | devServerURL: string, | 74 | devServerURL: string | undefined, |
77 | rendererIndexURL: string, | 75 | rendererIndexURL: string, |
78 | rendererRootURL: string, | 76 | rendererRootURL: string, |
79 | ) => { | 77 | ) => { |