Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Last active June 15, 2020 12:10
Show Gist options
  • Save kianaditya/b3a577cd8f14fffcc2a36c1c3aac98a6 to your computer and use it in GitHub Desktop.
Save kianaditya/b3a577cd8f14fffcc2a36c1c3aac98a6 to your computer and use it in GitHub Desktop.
//posts.spec.js
const request = require('supertest')
const app = require('../src/app') // the express server
const expect = require('chai').expect
describe('GET /posts endpoint', () => {
it('GET /posts endpoint successfully returns response', () => {
return request(app)
.get('/posts')
.then((response) => {
expect(response.statusCode).to.equal(200)
expect(response.text).to.equal('You have hit GET /posts endpoint')
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment