From e23c2dafefd36448bd068562079a01040abb373d Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 31 Aug 2023 10:44:05 +0200 Subject: [PATCH] Merge pull request #14409 from overleaf/jpa-open-source-history-v1-tests [web] enable history-v1 tests for Server Pro/CE GitOrigin-RevId: 74119a09c101ed74c37833384722f85b0e3830dd --- services/web/config/settings.defaults.js | 7 ++++++- .../history-v1/test/acceptance/src/HistoryTests.js | 8 +++++++- .../web/test/acceptance/src/mocks/MockV1HistoryApi.js | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/services/web/config/settings.defaults.js b/services/web/config/settings.defaults.js index b07e0c9e2d..d45bc439a4 100644 --- a/services/web/config/settings.defaults.js +++ b/services/web/config/settings.defaults.js @@ -812,7 +812,12 @@ module.exports = { managedGroupEnrollmentInvite: [], }, - moduleImportSequence: ['launchpad', 'server-ce-scripts', 'user-activate'], + moduleImportSequence: [ + 'history-v1', + 'launchpad', + 'server-ce-scripts', + 'user-activate', + ], csp: { enabled: process.env.CSP_ENABLED === 'true', diff --git a/services/web/modules/history-v1/test/acceptance/src/HistoryTests.js b/services/web/modules/history-v1/test/acceptance/src/HistoryTests.js index 25c73cc47c..bb3639011b 100644 --- a/services/web/modules/history-v1/test/acceptance/src/HistoryTests.js +++ b/services/web/modules/history-v1/test/acceptance/src/HistoryTests.js @@ -295,6 +295,12 @@ describe('History', function () { (appRoute.route != null ? appRoute.route.path : undefined) === '/api/projects/:project_id/version/:version/zip' ) + MockV1HistoryApi.app.get( + '/api/projects/:project_id/version/:version/zip', + (req, res, next) => { + res.sendStatus(500) + } + ) MockV1HistoryApi.app.post( '/api/projects/:project_id/version/:version/zip', (req, res, next) => { @@ -309,7 +315,7 @@ describe('History', function () { MockV1HistoryApi.applyRoutes() }) - it('should produce 404 when post request produces 404', function (done) { + it('should produce 500', function (done) { this.owner.createProject('example-project', (error, projectId) => { if (error) { return done(error) diff --git a/services/web/test/acceptance/src/mocks/MockV1HistoryApi.js b/services/web/test/acceptance/src/mocks/MockV1HistoryApi.js index 61076da85d..204c6a148b 100644 --- a/services/web/test/acceptance/src/mocks/MockV1HistoryApi.js +++ b/services/web/test/acceptance/src/mocks/MockV1HistoryApi.js @@ -17,6 +17,7 @@ class MockV1HistoryApi extends AbstractMockApi { this.app.get( '/api/projects/:project_id/version/:version/zip', (req, res, next) => { + this.sentChunks++ zipAttachment( res, `Mock zip for ${req.params.project_id} at version ${req.params.version}`,