mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
fix unit tests
This commit is contained in:
@@ -18,7 +18,7 @@ describe('maintenance mode middleware', () => {
|
||||
it('does not return 503 error when maintenance mode is off', () => {
|
||||
req = generateReq();
|
||||
sandbox.stub(nconf, 'get').withArgs('MAINTENANCE_MODE').returns('false');
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware);
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware).default;
|
||||
|
||||
attachMaintenanceMode(req, res, next);
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('maintenance mode middleware', () => {
|
||||
it('returns 503 error when maintenance mode is on', () => {
|
||||
req = generateReq();
|
||||
sandbox.stub(nconf, 'get').withArgs('MAINTENANCE_MODE').returns('true');
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware);
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware).default;
|
||||
|
||||
attachMaintenanceMode(req, res, next);
|
||||
|
||||
@@ -41,7 +41,7 @@ describe('maintenance mode middleware', () => {
|
||||
it('renders maintenance page when request type is HTML', () => {
|
||||
req = generateReq({headers: {accept: 'text/html'}});
|
||||
sandbox.stub(nconf, 'get').withArgs('MAINTENANCE_MODE').returns('true');
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware);
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware).default;
|
||||
|
||||
attachMaintenanceMode(req, res, next);
|
||||
expect(res.render).to.have.been.calledOnce;
|
||||
@@ -50,7 +50,7 @@ describe('maintenance mode middleware', () => {
|
||||
it('sends error message when request type is JSON', () => {
|
||||
req = generateReq({headers: {accept: 'application/json'}});
|
||||
sandbox.stub(nconf, 'get').withArgs('MAINTENANCE_MODE').returns('true');
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware);
|
||||
let attachMaintenanceMode = requireAgain(pathToMaintenanceModeMiddleware).default;
|
||||
|
||||
attachMaintenanceMode(req, res, next);
|
||||
expect(res.send).to.have.been.calledOnce;
|
||||
|
||||
Reference in New Issue
Block a user