Last active
June 17, 2020 08:16
-
-
Save kianaditya/e94c338f7919bdc1d58eaa0b060dfc3a to your computer and use it in GitHub Desktop.
medium express second article
This file contains hidden or 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
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