From 9e86fb279be7511e27abb6da57d06ba073cf1e70 Mon Sep 17 00:00:00 2001 From: Xavid Date: Wed, 6 May 2015 08:45:22 -0400 Subject: [PATCH] Fix backend tests with new setText() implementation; tests depended on the old setText() behavior leaving the last character. --- src/node/utils/ImportHtml.js | 2 +- tests/backend/specs/api/pad.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/node/utils/ImportHtml.js b/src/node/utils/ImportHtml.js index 33fd91c65..d71e27201 100644 --- a/src/node/utils/ImportHtml.js +++ b/src/node/utils/ImportHtml.js @@ -89,7 +89,7 @@ function setPadHTML(pad, html, callback) // the changeset is ready! var theChangeset = builder.toString(); apiLogger.debug('The changeset: ' + theChangeset); - pad.setText(""); + pad.setText("\n"); pad.appendRevision(theChangeset); callback(null); } diff --git a/tests/backend/specs/api/pad.js b/tests/backend/specs/api/pad.js index 75e779714..a2e8cdb3c 100644 --- a/tests/backend/specs/api/pad.js +++ b/tests/backend/specs/api/pad.js @@ -210,7 +210,7 @@ describe('getText', function(){ it('gets the Pad text', function(done) { api.get(endPoint('getText')+"&padID="+testPadId) .expect(function(res){ - if(res.body.data.text !== "testTextTwo\n") throw new Error("Setting Text") + if(res.body.data.text !== "testTextTwo") throw new Error("Setting Text") }) .expect('Content-Type', /json/) .expect(200, done) @@ -386,7 +386,7 @@ describe('getText', function(){ api.get(endPoint('getText')+"&padID="+testPadId) .expect(function(res){ if(res.body.code !== 0) throw new Error("Pad Get Text failed") - if(res.body.data.text !== text+"\n") throw new Error("Pad Text not set properly"); + if(res.body.data.text !== text) throw new Error("Pad Text not set properly"); }) .expect('Content-Type', /json/) .expect(200, done) @@ -419,7 +419,7 @@ describe('getText', function(){ it('Gets text on a pad Id', function(done) { api.get(endPoint('getText')+"&padID="+newPadId) .expect(function(res){ - if(res.body.data.text !== text+"\n") throw new Error("Pad Get Text failed") + if(res.body.data.text !== text) throw new Error("Pad Get Text failed") }) .expect('Content-Type', /json/) .expect(200, done) @@ -441,7 +441,7 @@ describe('getText', function(){ it('Gets text on a pad Id', function(done) { api.get(endPoint('getText')+"&padID="+testPadId) .expect(function(res){ - if(res.body.data.text !== text+"\n") throw new Error("Pad Get Text failed") + if(res.body.data.text !== text) throw new Error("Pad Get Text failed") }) .expect('Content-Type', /json/) .expect(200, done)