Skip to content

Instantly share code, notes, and snippets.

/server.test.ts Secret

Created March 7, 2018 06:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/3cc961b940c1906bacaec36e192ba625 to your computer and use it in GitHub Desktop.
import request from 'supertest';
import app from './app';
const mockListen = jest.fn();
app.listen = mockListen;
afterEach(() => {
test('Server works', async () => {
expect(mockListen.mock.calls[0][0]).toBe(process.env.PORT || 3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment