Skip to content

Commit 682fe8e

Browse files
committed
Tests for createMany and updateMany
1 parent 51ac4df commit 682fe8e

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' }, '')
7+
}, 5)
8+
9+
var many = [{ author_id: 2, text: 'bar' }, { author_id: 2, text: 'foo' }]
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_id: 2, text: 'bar', id: 1 }, { author_id: 2, text: 'foo', id: 2 }]
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)