Skip to content

Instantly share code, notes, and snippets.

@kharandziuk
Created November 28, 2018 14:11
Show Gist options
  • Select an option

  • Save kharandziuk/d711cbb366b41966dfca501a5b2975bf to your computer and use it in GitHub Desktop.

Select an option

Save kharandziuk/d711cbb366b41966dfca501a5b2975bf to your computer and use it in GitHub Desktop.
express-supertest-hello-world gist
const S = require('supertest')
const { expect } = require('chai')
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
//app.listen(port, () => console.log(`Example app listening on port ${port}!`))
describe('server', () => {
it('hello world', async () => {
const { text }= await S(app).get('/')
expect(text).eql('Hello World!')
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment