Instantly share code, notes, and snippets.

Embed
What would you like to do?
describe('when user was successfully logged in', () => {
const externalResponseHeaders = {
'set-cookie': 'valid-cookie-from-external-endpoint',
};
beforeEach(async () => {
simulateSucessfulLoginResponse(externalResponseHeaders); // implementation should not be relevant for this demonstration
await executeAction(); // implementation should not be relevant for this demonstration
});
it('should send OK with correct headers', () => {
expect(response.status).toHaveBeenCalledWith(200);
expect(response.header).toHaveBeenCalledWith('set-cookie', externalResponseHeaders['set-cookie']);
expect(response.send).toHaveBeenCalledTimes(1);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment