Skip to content

Commit

Permalink
test: improve test coverage of deleteMany
Browse files Browse the repository at this point in the history
  • Loading branch information
jhomarolo committed Jun 18, 2022
1 parent f375b99 commit eed94b6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "mocha --timeout 999999 --colors --recursive ./test",
"testdb": "mocha --timeout 999999 --colors --exit --recursive ./testdb",
"coverage-report": "nyc --reporter=html --reporter=text mocha --recursive ./test --timeout 10000",
"coverage-report": "nyc --reporter=html --reporter=html mocha --recursive ./test --timeout 10000",
"coverage": "nyc --reporter=text mocha --recursive ./test --timeout 10000",
"semantic-release": "semantic-release",
"lint": "npx eslint \"**/*.{js,jsx}\" --quiet",
Expand Down
20 changes: 20 additions & 0 deletions test/queries/deleteMany.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,24 @@ describe("Delete an Entity by id", () => {
//then
assert.deepStrictEqual(ret, true)
})

it("should delete all", async () => {
//given
let spy = {}
const anEntity = givenAnEntity()
const ItemRepository = givenAnRepositoryClass()
const collectionName = "aCollection"
const itemRepo = new ItemRepository({
entity: anEntity,
collection: collectionName,
ids: ["id"],
mongodb: mongodb(spy)
})

//when
const ret = await itemRepo.deleteMany({ })

//then
assert.deepStrictEqual(ret, true)
})
})

0 comments on commit eed94b6

Please sign in to comment.