mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
tests: add tests for listAllPads() API call
--HG-- branch : padlist-use-set
This commit is contained in:
parent
df08883a00
commit
8c4625ec50
1 changed files with 29 additions and 6 deletions
|
@ -173,6 +173,19 @@ describe('getHTML', function(){
|
|||
});
|
||||
})
|
||||
|
||||
describe('listAllPads', function () {
|
||||
it('list all pads', function (done) {
|
||||
api.get(endPoint('listAllPads'))
|
||||
.expect(function (res) {
|
||||
if (res.body.data.padIDs.includes(testPadId) !== true) {
|
||||
throw new Error('Unable to find pad in pad list')
|
||||
}
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
})
|
||||
})
|
||||
|
||||
describe('deletePad', function(){
|
||||
it('deletes a Pad', function(done) {
|
||||
api.get(endPoint('deletePad')+"&padID="+testPadId)
|
||||
|
@ -184,6 +197,19 @@ describe('deletePad', function(){
|
|||
});
|
||||
})
|
||||
|
||||
describe('listAllPads', function () {
|
||||
it('list all pads', function (done) {
|
||||
api.get(endPoint('listAllPads'))
|
||||
.expect(function (res) {
|
||||
if (res.body.data.padIDs.includes(testPadId) !== false) {
|
||||
throw new Error('Test pad should not be in pads list')
|
||||
}
|
||||
})
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200, done)
|
||||
})
|
||||
})
|
||||
|
||||
describe('getHTML', function(){
|
||||
it('get the HTML of a Pad -- Should return a failure', function(done) {
|
||||
api.get(endPoint('getHTML')+"&padID="+testPadId)
|
||||
|
@ -402,11 +428,8 @@ describe('createPad', function(){
|
|||
|
||||
describe('setText', function(){
|
||||
it('Sets text on a pad Id', function(done) {
|
||||
api.post(endPoint('setText'))
|
||||
.send({
|
||||
"padID": testPadId,
|
||||
"text": text,
|
||||
})
|
||||
api.post(endPoint('setText')+"&padID="+testPadId)
|
||||
.field({text: text})
|
||||
.expect(function(res){
|
||||
if(res.body.code !== 0) throw new Error("Pad Set Text failed")
|
||||
})
|
||||
|
@ -430,7 +453,7 @@ describe('getText', function(){
|
|||
describe('setText', function(){
|
||||
it('Sets text on a pad Id including an explicit newline', function(done) {
|
||||
api.post(endPoint('setText')+"&padID="+testPadId)
|
||||
.send({text: text+'\n'})
|
||||
.field({text: text+'\n'})
|
||||
.expect(function(res){
|
||||
if(res.body.code !== 0) throw new Error("Pad Set Text failed")
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue