Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Mar 19, 2024
1 parent 13c3ff9 commit 1459e25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/src/resources/__tests__/useNotifyService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ describe('useNotifyService', () => {
})

it('should return set HTTP refetch to always and fire an analytics reporting event if the connection was refused', () => {
vi.mocked(appShellListener).mockImplementation(function ({ callback }): any {
vi.mocked(appShellListener).mockImplementation(function ({
callback,
}): any {
// eslint-disable-next-line n/no-callback-literal
callback('ECONNREFUSED')
})
Expand All @@ -155,9 +157,11 @@ describe('useNotifyService', () => {
})

it('should trigger a single HTTP refetch if the refetch flag was returned', () => {
vi.mocked(appShellListener).mockImplementation(function ({ callback }): any {
vi.mocked(appShellListener).mockImplementation(function ({
callback,
}): any {
// eslint-disable-next-line n/no-callback-literal
callback('ECONNREFUSED')
callback({ refetchUsingHTTP: true })
})
const { rerender } = renderHook(() =>
useNotifyService({
Expand All @@ -171,9 +175,11 @@ describe('useNotifyService', () => {
})

it('should trigger a single HTTP refetch if the unsubscribe flag was returned', () => {
vi.mocked(appShellListener).mockImplementation(function ({ callback }): any {
vi.mocked(appShellListener).mockImplementation(function ({
callback,
}): any {
// eslint-disable-next-line n/no-callback-literal
callback('ECONNREFUSED')
callback({ unsubscribe: true })
})
const { rerender } = renderHook(() =>
useNotifyService({
Expand Down
1 change: 1 addition & 0 deletions setup-vitest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ vi.mock('protocol-designer/src/labware-defs/utils')
vi.mock('electron-store')
vi.mock('electron-updater')
vi.mock('electron')
vi.mock('./app/src/redux/shell/remote')

process.env.OT_PD_VERSION = 'fake_PD_version'
global._PKG_VERSION_ = 'test environment'
Expand Down

0 comments on commit 1459e25

Please sign in to comment.