diff options
author | Kristóf Marussy <kristof@marussy.com> | 2022-01-09 22:16:29 +0100 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2022-01-09 22:17:26 +0100 |
commit | fb7118ff1c8f0dcd61f15e51b193512283d83fa1 (patch) | |
tree | 721cee6a64b44a56b7f05f39750a65cda5fb4ef6 /packages/preload/src/contextBridge/__tests__/createSophieRenderer.spec.ts | |
parent | build: Add eslint-plugin-jest (diff) | |
download | sophie-fb7118ff1c8f0dcd61f15e51b193512283d83fa1.tar.gz sophie-fb7118ff1c8f0dcd61f15e51b193512283d83fa1.tar.zst sophie-fb7118ff1c8f0dcd61f15e51b193512283d83fa1.zip |
build: Add eslint-plugin-unicorn
Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/preload/src/contextBridge/__tests__/createSophieRenderer.spec.ts')
-rw-r--r-- | packages/preload/src/contextBridge/__tests__/createSophieRenderer.spec.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/preload/src/contextBridge/__tests__/createSophieRenderer.spec.ts b/packages/preload/src/contextBridge/__tests__/createSophieRenderer.spec.ts index b0af280..88b0077 100644 --- a/packages/preload/src/contextBridge/__tests__/createSophieRenderer.spec.ts +++ b/packages/preload/src/contextBridge/__tests__/createSophieRenderer.spec.ts | |||
@@ -45,7 +45,7 @@ const { default: createSophieRenderer } = await import( | |||
45 | ); | 45 | ); |
46 | 46 | ||
47 | const event: Electron.IpcRendererEvent = | 47 | const event: Electron.IpcRendererEvent = |
48 | null as unknown as Electron.IpcRendererEvent; | 48 | undefined as unknown as Electron.IpcRendererEvent; |
49 | 49 | ||
50 | const snapshot: SharedStoreSnapshotIn = { | 50 | const snapshot: SharedStoreSnapshotIn = { |
51 | shouldUseDarkColors: true, | 51 | shouldUseDarkColors: true, |
@@ -183,7 +183,7 @@ describe('SharedStoreConnector', () => { | |||
183 | 183 | ||
184 | it('should catch listener errors', () => { | 184 | it('should catch listener errors', () => { |
185 | mocked(listener.onPatch).mockImplementation(() => { | 185 | mocked(listener.onPatch).mockImplementation(() => { |
186 | throw new Error(); | 186 | throw new Error('listener error'); |
187 | }); | 187 | }); |
188 | expect(() => onSharedStorePatch(event, patch)).not.toThrow(); | 188 | expect(() => onSharedStorePatch(event, patch)).not.toThrow(); |
189 | }); | 189 | }); |
@@ -193,7 +193,7 @@ describe('SharedStoreConnector', () => { | |||
193 | describe('after the listener threw in onPatch', () => { | 193 | describe('after the listener threw in onPatch', () => { |
194 | beforeEach(() => { | 194 | beforeEach(() => { |
195 | mocked(listener.onPatch).mockImplementation(() => { | 195 | mocked(listener.onPatch).mockImplementation(() => { |
196 | throw new Error(); | 196 | throw new Error('listener error'); |
197 | }); | 197 | }); |
198 | onSharedStorePatch(event, patch); | 198 | onSharedStorePatch(event, patch); |
199 | listener.onPatch.mockRestore(); | 199 | listener.onPatch.mockRestore(); |
@@ -205,7 +205,9 @@ describe('SharedStoreConnector', () => { | |||
205 | 205 | ||
206 | describe('when a listener failed to register due to IPC error', () => { | 206 | describe('when a listener failed to register due to IPC error', () => { |
207 | beforeEach(async () => { | 207 | beforeEach(async () => { |
208 | mocked(ipcRenderer.invoke).mockRejectedValue(new Error()); | 208 | mocked(ipcRenderer.invoke).mockRejectedValue( |
209 | new Error('ipcRenderer error'), | ||
210 | ); | ||
209 | try { | 211 | try { |
210 | await sut.onSharedStoreChange(listener); | 212 | await sut.onSharedStoreChange(listener); |
211 | } catch { | 213 | } catch { |
@@ -237,7 +239,7 @@ describe('SharedStoreConnector', () => { | |||
237 | beforeEach(async () => { | 239 | beforeEach(async () => { |
238 | mocked(ipcRenderer.invoke).mockResolvedValueOnce(snapshot); | 240 | mocked(ipcRenderer.invoke).mockResolvedValueOnce(snapshot); |
239 | mocked(listener.onSnapshot).mockImplementation(() => { | 241 | mocked(listener.onSnapshot).mockImplementation(() => { |
240 | throw new Error(); | 242 | throw new Error('listener error'); |
241 | }); | 243 | }); |
242 | try { | 244 | try { |
243 | await sut.onSharedStoreChange(listener); | 245 | await sut.onSharedStoreChange(listener); |