Skip to content

Instantly share code, notes, and snippets.

@whtswrng
Created November 7, 2018 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whtswrng/439aa95381837475cefcba55d1aa9352 to your computer and use it in GitHub Desktop.
Save whtswrng/439aa95381837475cefcba55d1aa9352 to your computer and use it in GitHub Desktop.
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