Skip to content

Commit

Permalink
tests: 100% coverage again
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Jan 3, 2022
1 parent c57916f commit a7751fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/header/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ export const defaultHeaderInterpreter: HeadersInterpreter = (headers) => {

return (maxAge - Number(age)) * 1000;
}

return undefined;
}

const expires = headers[Header.Expires];
Expand Down
13 changes: 12 additions & 1 deletion test/interceptors/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createValidateStatus } from '../../src/interceptors/util';
import { createValidateStatus, isMethodIn } from '../../src/interceptors/util';

describe('test util functions', () => {
it('tests validate-status function', async () => {
Expand All @@ -19,4 +19,15 @@ describe('test util functions', () => {
expect(randomValue(405)).toBe(true);
expect(randomValue(304)).toBe(true);
});

it('tests isMethodIn function', () => {
expect(isMethodIn('get', ['get', 'post'])).toBe(true);
expect(isMethodIn('get', ['get', 'post', 'put'])).toBe(true);
expect(isMethodIn('post', ['get', 'post', 'put'])).toBe(true);

expect(isMethodIn('get')).toBe(false);
expect(isMethodIn('get', [])).toBe(false);
expect(isMethodIn('post', ['get', 'put', 'delete'])).toBe(false);
expect(isMethodIn('get', ['post', 'put', 'delete'])).toBe(false);
});
});

0 comments on commit a7751fd

Please sign in to comment.