Skip to content

Instantly share code, notes, and snippets.

@kianaditya
Last active June 17, 2020 08:16
Show Gist options
  • Save kianaditya/e94c338f7919bdc1d58eaa0b060dfc3a to your computer and use it in GitHub Desktop.
Save kianaditya/e94c338f7919bdc1d58eaa0b060dfc3a to your computer and use it in GitHub Desktop.
medium express second article
const request = require('supertest')
const app = require('../src/app')
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.body)
.to.be.an.instanceof(Array)
.and.to.have.length(4)
.and.to.have.property(0)
.that.includes.all.keys(['id', 'title', 'content'])
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment