Skip to content

Commit

Permalink
fix: Relax Allow Header Test (#562)
Browse files Browse the repository at this point in the history
Problem: The test asserted the order of methods in the Allow header. The
order is irrelevant for the header and not guaranteed by the code, so
that the test failed using Node 10.

Solution: Adjust the assertion to check the returned methods
irrespective of order.
  • Loading branch information
ahilke committed Mar 13, 2021
1 parent 33bb0f1 commit 69cdc9f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/allow.header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ describe(packageJson.name, () => {
app.server.close();
});

it('adds allow header to 405 - Method Not Allowed', async () =>
it('adds "Allow" header to 405 - Method Not Allowed', async () =>
request(app)
.put('/v1/pets/greebo')
.expect(405)
.then((response) => {
expect(response.header).to.include({ allow: 'POST, GET' });
expect(response.header.allow.split(', ')).to.have.members([
'GET',
'POST',
]);
}));
});

Expand Down

0 comments on commit 69cdc9f

Please sign in to comment.