mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 05:37:22 +01:00
add basic test, disable etag on post routes as well, paypal ipn: prevent set headers after response error
This commit is contained in:
31
test/api/unit/middlewares/cache.test.js
Normal file
31
test/api/unit/middlewares/cache.test.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import {
|
||||
generateRes,
|
||||
generateReq,
|
||||
generateNext,
|
||||
} from '../../../helpers/api-unit.helper';
|
||||
import {
|
||||
disableCache,
|
||||
} from '../../../../website/server/middlewares/cache';
|
||||
|
||||
describe('cache middlewares', () => {
|
||||
let res; let req; let
|
||||
next;
|
||||
|
||||
beforeEach(() => {
|
||||
req = generateReq();
|
||||
res = generateRes();
|
||||
next = generateNext();
|
||||
});
|
||||
|
||||
describe('disableCache', () => {
|
||||
it('sets the correct headers', () => {
|
||||
disableCache(req, res, next);
|
||||
expect(res.set).to.have.been.calledWith('Cache-Control', 'no-store');
|
||||
expect(next).to.have.been.calledOnce;
|
||||
});
|
||||
|
||||
xit('removes the etag header', () => {
|
||||
// @TODO how to stub onHeaders
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user