mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
tests: 100% coverage again
This commit is contained in:
parent
c57916fd67
commit
a7751fd1cb
@ -35,8 +35,6 @@ export const defaultHeaderInterpreter: HeadersInterpreter = (headers) => {
|
||||
|
||||
return (maxAge - Number(age)) * 1000;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const expires = headers[Header.Expires];
|
||||
|
||||
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user