mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Move delete cacth to afterEach
This commit is contained in:
@@ -11,14 +11,16 @@ describe('analytics middleware', function() {
|
|||||||
let pathToAnalyticsMiddleware = '../../../../../website/src/middlewares/api-v3/analytics';
|
let pathToAnalyticsMiddleware = '../../../../../website/src/middlewares/api-v3/analytics';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
res = generateRes();
|
||||||
|
req = generateReq();
|
||||||
|
next = generateNext();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
// The nconf.get('IS_PROD') occurs when the file is required
|
// The nconf.get('IS_PROD') occurs when the file is required
|
||||||
// Since node caches IS_PROD, we have to delete it from the cache
|
// Since node caches IS_PROD, we have to delete it from the cache
|
||||||
// to test prod vs non-prod behaviors
|
// to test prod vs non-prod behaviors
|
||||||
delete require.cache[require.resolve(pathToAnalyticsMiddleware)];
|
delete require.cache[require.resolve(pathToAnalyticsMiddleware)];
|
||||||
|
|
||||||
res = generateRes();
|
|
||||||
req = generateReq();
|
|
||||||
next = generateNext();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('attaches analytics object res.locals', function() {
|
it('attaches analytics object res.locals', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user