Skip to content

Commit 9ede3ec

Browse files
committed
Tests for createMany and updateMany
1 parent f8b9e71 commit 9ede3ec

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

test/createMany.test.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
describe('createMany', function () {
2-
it('should createMany')
2+
it('should createMany', function (done) {
3+
var Test = this
4+
5+
setTimeout(function () {
6+
Test.requests[0].respond(200, { 'Content-Type': 'application/json' }, JSON.stringify([Test.p1, Test.p2]))
7+
}, 5)
8+
9+
var many = [{ author: 'John', age: 30 }, { author: 'Sally', age: 31 }]
10+
Test.Post.createMany(many).then(function (result) {
11+
Test.assert.equal(Test.requests[0].url, 'api/posts')
12+
Test.assert.equal(Test.requests[0].method, 'POST')
13+
Test.assert.equal(Test.requests[0].requestBody, JSON.stringify(many))
14+
done()
15+
})
16+
})
317
})

test/updateMany.test.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1-
describe('updateMany', function () {
2-
it('should updateMany')
1+
describe('createMany', function () {
2+
it('should createMany', function (done) {
3+
var Test = this
4+
var many = [{ author: 'John', age: 31, id: 5 }, { author: 'Sally', age: 32, id: 6 }]
5+
6+
setTimeout(function () {
7+
Test.requests[0].respond(200, { 'Content-Type': 'application/json' }, JSON.stringify(many))
8+
}, 5)
9+
10+
Test.Post.updateMany(many).then(function (result) {
11+
Test.assert.equal(Test.requests[0].url, 'api/posts')
12+
Test.assert.equal(Test.requests[0].method, 'PUT')
13+
Test.assert.equal(Test.requests[0].requestBody, JSON.stringify(many))
14+
done()
15+
})
16+
})
317
})

0 commit comments

Comments
 (0)