This commit is contained in:
typicode
2020-11-15 23:50:27 +01:00
parent 8928b6af34
commit f1621c38fe
31 changed files with 481 additions and 557 deletions

View File

@ -13,13 +13,13 @@ describe('Server with custom foreign key', () => {
db.posts = [
{ id: 1, body: 'foo' },
{ id: 2, body: 'bar' }
{ id: 2, body: 'bar' },
]
db.comments = [
{ id: 1, post_id: 1 },
{ id: 2, post_id: 1 },
{ id: 3, post_id: 2 }
{ id: 3, post_id: 2 },
]
server = jsonServer.create()
@ -109,10 +109,7 @@ describe('Server with custom foreign key', () => {
describe('DELETE /:resource/:id', () => {
test('should respond with empty data, destroy resource and dependent resources', async () => {
await request(server)
.del('/posts/1')
.expect({})
.expect(200)
await request(server).del('/posts/1').expect({}).expect(200)
assert.strictEqual(db.posts.length, 1)
assert.strictEqual(db.comments.length, 1)
})