chore: use splat instead of lodash to clone, remove unnecessary expectations

This commit is contained in:
Riqwan Thamir authored and Adrien de Peretti committed 2022-12-07 16:42:32 +01:00
1 parent 40694bd5d1
commit c1cdb80436
4 files changed
+14 -25

No files matched your search

@@ -54,21 +54,18 @@ describe("DiscountService", () => {
})
it("fails to create a discount without regions", async () => {
expect.assertions(3)
try {
await discountService.create({
code: "test",
rule: {
type: "fixed",
allocation: "total",
value: 20,
},
})
} catch (err) {
expect(err.type).toEqual("invalid_data")
expect(err.message).toEqual("Discount must have atleast 1 region")
expect(discountRepository.create).toHaveBeenCalledTimes(0)
}
const err = await discountService.create({
code: "test",
rule: {
type: "fixed",
allocation: "total",
value: 20,
},
}).catch(e => e)
expect(err.type).toEqual("invalid_data")
expect(err.message).toEqual("Discount must have atleast 1 region")
expect(discountRepository.create).toHaveBeenCalledTimes(0)
})
it("successfully creates discount", async () => {