From eed94b6c48c568c2dad3bbd6471f606726313847 Mon Sep 17 00:00:00 2001 From: Jhonathan Soares Date: Sat, 18 Jun 2022 17:40:50 -0300 Subject: [PATCH] test: improve test coverage of deleteMany --- package.json | 2 +- test/queries/deleteMany.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 78ef0bb..2ac4781 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/queries/deleteMany.js b/test/queries/deleteMany.js index 4a3cd07..63dfcb1 100644 --- a/test/queries/deleteMany.js +++ b/test/queries/deleteMany.js @@ -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) + }) })