Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
fix: update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiendan committed Feb 9, 2024
1 parent a7328af commit 6928930
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/frontend/src/hooks/useExecutorService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import useExecutorService, {
ExecuteDto,
TracingOptions,
} from './useExecutorService'
import { ExecuteError, ExecuteProcessorError } from '../types'

const validExecuteDtoMock: ExecuteDto = {
logIndexes: [],
Expand Down Expand Up @@ -145,6 +146,10 @@ describe('observeExecutorServiceJob', () => {
})

it('should error() when eventsource sends error event', async () => {
const errorMock: ExecuteError = {
type: ExecuteProcessorError.CERTIFICATE_NOT_FOUND,
message: 'message',
}
const { result } = renderHook(() => useExecutorService())

await waitFor(() => {
Expand All @@ -158,13 +163,13 @@ describe('observeExecutorServiceJob', () => {
)
observable.subscribe({
error: (error) => {
expect(error).toBe('"any error"')
expect(error).toBe(errorMock.message)
},
})

sources[
`${import.meta.env.VITE_EXECUTOR_SERVICE_ENDPOINT}/v1/job/subscribe/1`
].emitError('any error')
].emitError({ data: JSON.stringify(errorMock) })
}
})
})

0 comments on commit 6928930

Please sign in to comment.