-
-
Save anonymous/3cc961b940c1906bacaec36e192ba625 to your computer and use it in GitHub Desktop.
This file contains 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
import request from 'supertest'; | |
import app from './app'; | |
const mockListen = jest.fn(); | |
app.listen = mockListen; | |
afterEach(() => { | |
mockListen.mockReset(); | |
}); | |
test('Server works', async () => { | |
require('./server'); | |
expect(mockListen.mock.calls.length).toBe(1); | |
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