Skip to content

Commit

Permalink
add test case for max len
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Feb 13, 2020
1 parent c93590a commit 1d11adf
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/headers.2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe(packageJson.name, () => {
app.server.close();
});

it.only('should return 400 missing required header', async () => {
it('should return 400 missing required header', async () => {
return request(app)
.get(`${app.basePath}/headers_1`)
.expect(400)
Expand All @@ -43,7 +43,24 @@ describe(packageJson.name, () => {
});
});

it.only('should return 200 for valid headers', async () => {
it('should return 400 missing required header', async () => {
let longString = '';
for (let i = 0; i < 300; i++) {
longString += 'a';
}
return request(app)
.get(`${app.basePath}/headers_1`)
.set('x-userid', longString)
.expect(400)
.then(r => {
const e = r.body;
expect(e.message).to.contain(
'should NOT be longer than 255 characters',
);
});
});

it('should return 200 for valid headers', async () => {
return request(app)
.get(`${app.basePath}/headers_1`)
.set('x-userid', 'some-id')
Expand Down

0 comments on commit 1d11adf

Please sign in to comment.