Created
June 24, 2022 12:32
-
-
Save lloydjatkinson/36cf560a640efe5e9a3173269675935b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('send-incidents.js', () => { | |
let axiosMock; | |
let mockSendIncidentFormData; | |
beforeEach(() => { | |
axiosMock = new MockAdapter(axios); | |
mockSendIncidentFormData = { | |
message: faker.random.words(), | |
}; | |
jest.spyOn(eventBusHandler, 'bearerTokenMiddleware').mockImplementation((name) => Promise.resolve({ | |
success: true, | |
bearerToken: 'mock-bearer-token', | |
})); | |
}); | |
afterEach(() => { | |
jest.resetAllMocks(); | |
axiosMock.reset(); | |
}); | |
it('should send the incident and return a success value', async () => { | |
axiosMock | |
.onPost(`${environment.communications_incident_sms_throwaway_api_url}/send`) | |
.reply(200); | |
const response = await sendIncident(mockSendIncidentFormData); | |
expect(response).toMatchObject({ | |
success: true, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment