tests: 100% coverage again

This commit is contained in:
arthurfiorette 2022-01-03 09:21:16 -03:00
parent c57916fd67
commit a7751fd1cb
No known key found for this signature in database
GPG Key ID: 9D190CD53C53C555
2 changed files with 12 additions and 3 deletions

View File

@ -35,8 +35,6 @@ export const defaultHeaderInterpreter: HeadersInterpreter = (headers) => {
return (maxAge - Number(age)) * 1000;
}
return undefined;
}
const expires = headers[Header.Expires];

View File

@ -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 () => {
@ -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);
});
});