mirror of
https://github.com/arthurfiorette/axios-cache-interceptor.git
synced 2025-12-08 17:36:16 +00:00
23 lines
728 B
TypeScript
23 lines
728 B
TypeScript
import Axios from 'axios';
|
|
import { setupCache } from '../../src/cache/create';
|
|
|
|
describe('tests header interpreter', () => {
|
|
it('tests argument composition', () => {
|
|
const withAxios = setupCache(Axios.create());
|
|
expect(withAxios).not.toBeUndefined();
|
|
expect(withAxios.defaults.cache.ttl).not.toBe(1234);
|
|
|
|
const withConfig = setupCache(Axios.create(), { ttl: 1234 });
|
|
expect(withConfig).not.toBeUndefined();
|
|
expect(withConfig.defaults.cache.ttl).toBe(1234);
|
|
});
|
|
|
|
it('expects double registration is rejected', () => {
|
|
const axios = Axios.create();
|
|
const withAxios = setupCache(axios);
|
|
expect(withAxios).not.toBeUndefined();
|
|
|
|
expect(() => setupCache(axios)).toThrowError();
|
|
});
|
|
});
|