mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
tests: Include the filename in the test output
Also some minor consistency cleanups.
This commit is contained in:
parent
50e402193b
commit
3e14016214
13 changed files with 2296 additions and 2276 deletions
|
@ -56,38 +56,39 @@ var testImports = {
|
|||
*/
|
||||
}
|
||||
|
||||
Object.keys(testImports).forEach(function (testName) {
|
||||
var testPadId = makeid();
|
||||
test = testImports[testName];
|
||||
describe('createPad', function(){
|
||||
it('creates a new Pad', function(done) {
|
||||
api.get(endPoint('createPad')+"&padID="+testPadId)
|
||||
.expect(function(res){
|
||||
if(res.body.code !== 0) throw new Error("Unable to create new Pad");
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
describe(__filename, function() {
|
||||
Object.keys(testImports).forEach(function(testName) {
|
||||
var testPadId = makeid();
|
||||
test = testImports[testName];
|
||||
describe('createPad', function() {
|
||||
it('creates a new Pad', function(done) {
|
||||
api.get(endPoint('createPad') + "&padID=" + testPadId)
|
||||
.expect(function(res) {
|
||||
if(res.body.code !== 0) throw new Error("Unable to create new Pad");
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
|
||||
describe('setHTML', function(){
|
||||
it('Sets the HTML', function(done) {
|
||||
api.get(endPoint('setHTML')+"&padID="+testPadId+"&html="+test.input)
|
||||
.expect(function(res){
|
||||
if(res.body.code !== 0) throw new Error("Error:"+testName)
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
describe('setHTML', function() {
|
||||
it('Sets the HTML', function(done) {
|
||||
api.get(endPoint('setHTML') + "&padID=" + testPadId + "&html=" + test.input)
|
||||
.expect(function(res) {
|
||||
if(res.body.code !== 0) throw new Error("Error:" + testName)
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
|
||||
describe('getHTML', function(){
|
||||
it('Gets back the HTML of a Pad', function(done) {
|
||||
api.get(endPoint('getHTML')+"&padID="+testPadId)
|
||||
.expect(function(res){
|
||||
var receivedHtml = res.body.data.html;
|
||||
if (receivedHtml !== test.expectedHTML) {
|
||||
throw new Error(`HTML received from export is not the one we were expecting.
|
||||
describe('getHTML', function() {
|
||||
it('Gets back the HTML of a Pad', function(done) {
|
||||
api.get(endPoint('getHTML') + "&padID=" + testPadId)
|
||||
.expect(function(res) {
|
||||
var receivedHtml = res.body.data.html;
|
||||
if (receivedHtml !== test.expectedHTML) {
|
||||
throw new Error(`HTML received from export is not the one we were expecting.
|
||||
Test Name:
|
||||
${testName}
|
||||
|
||||
|
@ -99,20 +100,20 @@ Object.keys(testImports).forEach(function (testName) {
|
|||
|
||||
Which is a different version of the originally imported one:
|
||||
${test.input}`);
|
||||
}
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
|
||||
describe('getText', function(){
|
||||
it('Gets back the Text of a Pad', function(done) {
|
||||
api.get(endPoint('getText')+"&padID="+testPadId)
|
||||
.expect(function(res){
|
||||
var receivedText = res.body.data.text;
|
||||
if (receivedText !== test.expectedText) {
|
||||
throw new Error(`Text received from export is not the one we were expecting.
|
||||
describe('getText', function() {
|
||||
it('Gets back the Text of a Pad', function(done) {
|
||||
api.get(endPoint('getText') + "&padID=" + testPadId)
|
||||
.expect(function(res) {
|
||||
var receivedText = res.body.data.text;
|
||||
if (receivedText !== test.expectedText) {
|
||||
throw new Error(`Text received from export is not the one we were expecting.
|
||||
Test Name:
|
||||
${testName}
|
||||
|
||||
|
@ -124,12 +125,13 @@ Object.keys(testImports).forEach(function (testName) {
|
|||
|
||||
Which is a different version of the originally imported one:
|
||||
${test.input}`);
|
||||
}
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
}
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue