-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- write tests for GET /api/v1/ - write code to make tests pass [Finishes #160296446]
- Loading branch information
Showing
3 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import express from 'express'; | ||
|
||
const router = express.Router(); | ||
|
||
router.get('/', (req, res) => { | ||
res.status(200).json({ | ||
message: 'Welcome to the fast food fast API!', | ||
}); | ||
}); | ||
|
||
export default router; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import chai from 'chai'; | ||
import 'chai/register-should'; | ||
import dirtyChai from 'dirty-chai'; | ||
import chaiHttp from 'chai-http'; | ||
import app from '../../server/index'; | ||
|
||
chai.use(chaiHttp); | ||
chai.use(dirtyChai); | ||
|
||
describe('GET /api/v1/', () => { | ||
it('should respond with a 200 status code', (done) => { | ||
chai.request(app) | ||
.get('/api/v1') | ||
.end((err, res) => { | ||
res.should.have.a.status(200); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should return an object with a message property', (done) => { | ||
chai.request(app) | ||
.get('/api/v1') | ||
.end((err, res) => { | ||
res.body.should.be.an('object').that.has.a.property('message').which.is.not.empty(); | ||
done(); | ||
}); | ||
}); | ||
}); |