Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Mar 22, 2019
1 parent 305b1e0 commit 3d23e95
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/routes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ describe(packageJson.name, () => {
it('should return 400 if required body is missing', async () =>
request(app)
.post('/v1/pets')
.set({
'content-type': 'application/json',
})
.set('content-type', 'application/json')
.expect(400)
.then(r => {
const e = r.body.errors;
Expand Down Expand Up @@ -106,7 +104,7 @@ describe(packageJson.name, () => {
}));
});

describe('POST /unknown-routes', () => {
describe.only('POST failures', () => {
it('should return 200 when post props are met', async () =>
request(app)
.post('/v1/unknown-route')
Expand All @@ -118,6 +116,18 @@ describe(packageJson.name, () => {
console.log(r.body);
}));

it('should return 415 when post props are met', async () =>
request(app)
.post('/v1/pets')
.send('<xml>stuff</xml>')
.set('content-type', 'application/xml')
.expect(415)
.then(r => {
const e = r.body.errors;
expect(e[0].message).to.equal(
'Unsupported Content-Type application/xml'
);
}));
// TODO write test when route exists, but doc does not
});

Expand Down

0 comments on commit 3d23e95

Please sign in to comment.