|
|
|
@ -109,7 +109,7 @@ frisby.create('Valid posting') |
|
|
|
}) |
|
|
|
}) |
|
|
|
.toss(); |
|
|
|
.toss(); |
|
|
|
|
|
|
|
|
|
|
|
frisby.create('Valid posting, editing and more') |
|
|
|
frisby.create('Valid posting, editing and removal') |
|
|
|
.post('http://localhost:3000/note', { |
|
|
|
.post('http://localhost:3000/note', { |
|
|
|
password: 'aabbcc', |
|
|
|
password: 'aabbcc', |
|
|
|
tos: 'on', |
|
|
|
tos: 'on', |
|
|
|
@ -157,20 +157,16 @@ frisby.create('Valid posting, editing and more') |
|
|
|
.get('http://localhost:3000/' + noteId) |
|
|
|
.get('http://localhost:3000/' + noteId) |
|
|
|
.expectStatus(200) |
|
|
|
.expectStatus(200) |
|
|
|
.expectBodyContains('Changed text!') |
|
|
|
.expectBodyContains('Changed text!') |
|
|
|
.toss(); |
|
|
|
.after((err, res, body) => { |
|
|
|
}) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
frisby.create('Read export of posted note') |
|
|
|
frisby.create('Read export of posted note') |
|
|
|
.expectStatus(200) |
|
|
|
.expectStatus(200) |
|
|
|
.get('http://localhost:3000/' + noteId + '/export') |
|
|
|
.get('http://localhost:3000/' + noteId + '/export') |
|
|
|
.expectHeaderContains('content-type', 'text/plain; charset=utf-8') |
|
|
|
.expectHeaderContains('content-type', 'text/plain; charset=utf-8') |
|
|
|
.expectBodyContains(testNote) |
|
|
|
.expectBodyContains('Changed text!') |
|
|
|
.toss(); |
|
|
|
.toss(); |
|
|
|
frisby.create('Open /edit on posted note') |
|
|
|
frisby.create('Open /edit on posted note') |
|
|
|
.expectStatus(200) |
|
|
|
.expectStatus(200) |
|
|
|
.expectBodyContains('<textarea autofocus name="text">' + testNote + '</textarea>') |
|
|
|
.expectBodyContains('<textarea autofocus name="text">Changed text!</textarea>') |
|
|
|
.get('http://localhost:3000/' + noteId + '/edit') |
|
|
|
.get('http://localhost:3000/' + noteId + '/edit') |
|
|
|
.toss(); |
|
|
|
.toss(); |
|
|
|
frisby.create('Read stats of posted note') |
|
|
|
frisby.create('Read stats of posted note') |
|
|
|
@ -181,6 +177,38 @@ frisby.create('Valid posting, editing and more') |
|
|
|
.expectBodyContains('<tr><td>Views</td><td>0</td></tr>') |
|
|
|
.expectBodyContains('<tr><td>Views</td><td>0</td></tr>') |
|
|
|
.toss(); |
|
|
|
.toss(); |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
.after((err, res, body) => { |
|
|
|
|
|
|
|
frisby.create('Note available') |
|
|
|
|
|
|
|
.get('http://localhost:3000/' + noteId) |
|
|
|
|
|
|
|
.expectStatus(200) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
frisby.create('Delete note with empty password') |
|
|
|
|
|
|
|
.post('http://localhost:3000/note', { "id": noteId, "tos": "on", "text": "" }) |
|
|
|
|
|
|
|
.expectStatus(400) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
frisby.create('Delete note with wrong password') |
|
|
|
|
|
|
|
.post('http://localhost:3000/note', { "id": noteId, "tos": "on", "text": "", "password": "xxyycc" }) |
|
|
|
|
|
|
|
.expectStatus(401) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.after((err, res, body) => { |
|
|
|
|
|
|
|
frisby.create('Delete note') |
|
|
|
|
|
|
|
.post('http://localhost:3000/note', { "id": noteId, "tos": "on", "text": "", "password": "aabbcc" }) |
|
|
|
|
|
|
|
.expectStatus(301) |
|
|
|
|
|
|
|
.after(function(err, res, body) { |
|
|
|
|
|
|
|
frisby.create('Note unavailable') |
|
|
|
|
|
|
|
.get('http://localhost:3000/' + noteId) |
|
|
|
|
|
|
|
.expectStatus(404) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.toss(); |
|
|
|
|
|
|
|
}) |
|
|
|
.toss(); |
|
|
|
.toss(); |
|
|
|
|
|
|
|
|
|
|
|
var tooLongNote = 'ABCD'; |
|
|
|
var tooLongNote = 'ABCD'; |
|
|
|
|