From b2927b62d7ae24f1fdaf99acd71b00fba103c1b5 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly <shane@kilkelly.me> Date: Fri, 22 Jun 2018 13:20:13 +0100 Subject: [PATCH] Fix tests after sync with master --- .../acceptance/coffee/LinkedFilesTests.coffee | 8 +++--- .../coffee/helpers/MockClsiApi.coffee | 26 +++++-------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/test/acceptance/coffee/LinkedFilesTests.coffee b/test/acceptance/coffee/LinkedFilesTests.coffee index 72fbf5502..0c369097c 100644 --- a/test/acceptance/coffee/LinkedFilesTests.coffee +++ b/test/acceptance/coffee/LinkedFilesTests.coffee @@ -369,7 +369,7 @@ describe "LinkedFiles", -> cb(error) ], done - it 'should import the output.pdf file from the source project', (done) -> + it 'should import the project.pdf file from the source project', (done) -> @owner.request.post { url: "/project/#{@project_one_id}/linked_file", json: @@ -378,7 +378,7 @@ describe "LinkedFiles", -> provider: 'project_output_file', data: source_project_id: @project_two_id, - source_output_file_path: "output.pdf", + source_output_file_path: "project.pdf", build_id: '1234-abcd' }, (error, response, body) => new_file_id = body.new_file_id @@ -391,7 +391,7 @@ describe "LinkedFiles", -> expect(firstFile.linkedFileData).to.deep.equal { provider: 'project_output_file', source_project_id: @project_two_id, - source_output_file_path: "output.pdf", + source_output_file_path: "project.pdf", build_id: '1234-abcd' } expect(firstFile.name).to.equal('test.pdf') @@ -428,7 +428,7 @@ describe "LinkedFiles", -> linkedFileData: { provider: "project_output_file", v1_source_doc_id: 9999999, # We won't find this id in the database - source_output_file_path: "output.pdf", + source_output_file_path: "project.pdf", build_id: '123' }, _id: "abcdef", diff --git a/test/acceptance/coffee/helpers/MockClsiApi.coffee b/test/acceptance/coffee/helpers/MockClsiApi.coffee index 60424af2a..0711ac613 100644 --- a/test/acceptance/coffee/helpers/MockClsiApi.coffee +++ b/test/acceptance/coffee/helpers/MockClsiApi.coffee @@ -4,7 +4,8 @@ app = express() module.exports = MockClsiApi = run: () -> - app.post "/project/:project_id/compile", (req, res, next) => + + compile = (req, res, next) => res.status(200).send { compile: status: 'success' @@ -22,6 +23,9 @@ module.exports = MockClsiApi = ] } + app.post "/project/:project_id/compile", compile + app.post "/project/:project_id/user/:user_id/compile", compile + app.get "/project/:project_id/build/:build_id/output/*", (req, res, next) -> filename = req.params[0] if filename == 'project.pdf' @@ -31,27 +35,11 @@ module.exports = MockClsiApi = else res.sendStatus(404) - app.post "/project/:project_id/compile", (req, res, next) => - res.json { - compile: - status: 'success' - outputFiles: [{path: 'output.pdf', build: 'abcd', url: 'http://example.com'}] - } - app.post "/project/:project_id/user/:user_id/compile", (req, res, next) => - res.json { - compile: - status: 'success' - outputFiles: [{path: 'output.pdf', build: 'abcd', url: 'http://example.com'}] - } - - app.get "/project/:project_id/status", (req, res, next) => - res.status(200).send() - app.get "/project/:project_id/user/:user_id/build/:build_id/output/:output_path", (req, res, next) => res.status(200).send("hello") - app.all "*", (req, res, next) => - next() + app.get "/project/:project_id/status", (req, res, next) => + res.status(200).send() app.listen 3013, (error) -> throw error if error? -- GitLab