fix commenting

This commit is contained in:
John McLear 2014-12-27 17:14:40 +01:00
parent 444bbf4cbc
commit 7708460faf
4 changed files with 53 additions and 9 deletions

View file

@ -61,6 +61,9 @@ describe('Permission', function(){
-> setText(padId)
-> getLastEdited(padID) -- Should be when setText was performed
-> padUsers(padID) -- Should be when setText was performed
-> setHTML(padID) -- Should fail on invalid HTML
-> setHTML(padID) -- Should fail on invalid HTML
-> getHTML(padID) -- Should return HTML close to posted HTML
*/
describe('deletePad', function(){
@ -265,6 +268,42 @@ describe('padUsers', function(){
});
})
describe('setHTML', function(){
it('Sets the HTML of a Pad', function(done) {
var html = "<!DOCTYPE html><html><head><title>Hello HTML</title></head><body<p>Hello World!</p></body></html>";
api.get(endPoint('setHTML')+"&padID="+testPadId+"&html="+html)
.expect(function(res){
if(res.body.code !== 0) throw new Error("Error importing HTML")
})
.expect('Content-Type', /json/)
.expect(200, done)
});
})
describe('setHTML', function(){
it('Sets the HTML of a Pad attempting to pass ugly HTML', function(done) {
var html = "<div><b>Hello HTML</title></head></div>";
api.get(endPoint('setHTML')+"&padID="+testPadId+"&html="+html)
.expect(function(res){
if(res.body.code !== 1) throw new Error("Allowing crappy HTML to be imported")
})
.expect('Content-Type', /json/)
.expect(200, done)
});
})
describe('setHTML', function(){
it('Sets the HTML of a Pad attempting to pass ugly HTML', function(done) {
var html = "<!DOCTYPE html><html><head></head><body><ul><li>Hello World!</li><li>foo</li></ul></body></html>";
api.get(endPoint('setHTML')+"&padID=test&html="+html)
.expect(function(res){
if(res.body.code !== 0) throw new Error("List HTML cant be imported")
})
.expect('Content-Type', /json/)
.expect(200, done)
});
})
var endPoint = function(point){

View file

@ -5,7 +5,6 @@ var assert = require('assert')
path = require('path');
var filePath = path.join(__dirname, '../../../../APIKEY.txt');
var apiKey = fs.readFileSync(filePath, {encoding: 'utf-8'});
apiKey = apiKey.replace(/\n$/, "");
var apiVersion = 1;