mirror of
https://github.com/Such-Software/wownerogue.git
synced 2026-10-18 22:58:32 +02:00
21 lines
602 B
JavaScript
21 lines
602 B
JavaScript
const noStore = require('../src/middleware/noStore');
|
|
|
|
describe('authenticated API cache policy', () => {
|
|
test('sets explicit no-store headers before continuing', () => {
|
|
const headers = {};
|
|
const response = {
|
|
setHeader: jest.fn((name, value) => { headers[name] = value; })
|
|
};
|
|
const next = jest.fn();
|
|
|
|
noStore({}, response, next);
|
|
|
|
expect(headers).toEqual({
|
|
'Cache-Control': 'no-store, max-age=0',
|
|
Pragma: 'no-cache',
|
|
Expires: '0'
|
|
});
|
|
expect(next).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|