From 4d6e2332c3097123bbf1468da7c25db77f93ceaf Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 27 Sep 2020 15:46:28 +0100 Subject: [PATCH] test coverage for read only pad ids --- tests/backend/specs/api/importexportGetPost.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/backend/specs/api/importexportGetPost.js b/tests/backend/specs/api/importexportGetPost.js index aa72f7072..3515d7776 100644 --- a/tests/backend/specs/api/importexportGetPost.js +++ b/tests/backend/specs/api/importexportGetPost.js @@ -87,6 +87,22 @@ describe('Imports and Exports', function(){ .expect((res) => assert.equal(res.body.data.text, padText.toString())); }); + it('gets read only pad Id and exports the html and text for this pad', async function(){ + let ro = await agent.get(endPoint('getReadOnlyID')+"&padID="+testPadId) + .expect(200) + .expect((res) => assert.ok(JSON.parse(res.text).data.readOnlyID)); + let readOnlyId = JSON.parse(ro.text).data.readOnlyID; + + await agent.get(`/p/${readOnlyId}/export/html`) + .expect(200) + .expect((res) => assert(res.text.indexOf("This is the") !== -1)); + + await agent.get(`/p/${readOnlyId}/export/txt`) + .expect(200) + .expect((res) => assert(res.text.indexOf("This is the") !== -1)); + }); + + describe('Import/Export tests requiring AbiWord/LibreOffice', function() { before(function() { if ((!settings.abiword || settings.abiword.indexOf('/') === -1) &&