Skip to content

Commit

Permalink
write test for create a new tweet
Browse files Browse the repository at this point in the history
  • Loading branch information
BenParisot committed Apr 15, 2019
1 parent c2c33a2 commit b61fa0b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
Empty file removed data/tweets.js
Empty file.
2 changes: 1 addition & 1 deletion lib/routes/tweets.js
@@ -1,4 +1,4 @@
const { Router } = require('express').Router();
const { Router } = require('express');
const Tweet = require('../models/Tweet');


Expand Down
23 changes: 17 additions & 6 deletions tests/app.test.js
@@ -1,10 +1,21 @@
const app = require('app');
const app = require('../lib/app');
const request = require('supertest');

describe('responds with hi at /hello', () => {
return request(app)
.get('/hello')
.then(res => {
expect(res.text).toEqual('hi');
describe('tweet router', () => {
it('creates a new tweet', () => {
return request(app)
.post('/tweets')
.send({
handle: 'ben',
body: 'hello there'
})
.then(res => {
expect(res.body).toEqual({
handle: 'ben',
body: 'hello there',
_id: expect.any(String)
});
});
});

});

0 comments on commit b61fa0b

Please sign in to comment.