Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
louptheron committed Dec 12, 2024
1 parent 18de512 commit 21aabc5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { PendingAlertValueType } from '@features/Alert/types'
import { fortyHeightHourAlertReporting } from '@features/Reporting/useCases/__tests__/__mocks__/dummyReporting'
import { archiveReporting } from '@features/Reporting/useCases/archiveReporting'
import { describe, it, expect, afterAll } from '@jest/globals'
import { dispatchProcessor } from '@store/__tests__/utils'
import { mockedDispatch } from '@store/__tests__/utils'

import { VesselIdentifier } from '../../../../domain/entities/vessel/types'
import { deleteReporting } from '../deleteReporting'
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('archiveReporting()', () => {

it('Should delete reporting When alert is MISSING_FAR_48_HOURS_ALERT', async () => {
// When
dispatchProcessor(archiveReporting(fortyHeightHourAlertReporting), INITIAL_STATE)
mockedDispatch(archiveReporting(fortyHeightHourAlertReporting), INITIAL_STATE)

// Then
expect(deleteReporting).toHaveBeenCalled()
Expand All @@ -62,7 +62,7 @@ describe('archiveReporting()', () => {
}

// When
dispatchProcessor(archiveReporting(otherAlertReporting), INITIAL_STATE)
mockedDispatch(archiveReporting(otherAlertReporting), INITIAL_STATE)

// Then
expect(deleteReporting).toHaveBeenCalledTimes(0)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/__tests__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { jest } from '@jest/globals'
* we could have more middleware functions being called within the
* use-case middleware, and we should be able to capture all of these events.
*/
export const dispatchProcessor = (action, initialState) => {
export const mockedDispatch = (action, initialState) => {
const store = {
dispatch: jest.fn(fn => {
if (typeof fn === 'function') {
Expand Down

0 comments on commit 21aabc5

Please sign in to comment.