From ac90bb3b1826a0a9a5ccc879df693aeb00bc545d Mon Sep 17 00:00:00 2001 From: gerard Date: Fri, 10 Aug 2018 16:31:44 +0200 Subject: [PATCH] /ticket/getSalesPersonMana.js Backend unit tests --- .../ticket/specs/getSalespersonMana.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 services/loopback/common/methods/ticket/specs/getSalespersonMana.spec.js diff --git a/services/loopback/common/methods/ticket/specs/getSalespersonMana.spec.js b/services/loopback/common/methods/ticket/specs/getSalespersonMana.spec.js new file mode 100644 index 000000000..c804ec592 --- /dev/null +++ b/services/loopback/common/methods/ticket/specs/getSalespersonMana.spec.js @@ -0,0 +1,15 @@ +const app = require(`${servicesDir}/ticket/server/server`); + +describe('ticket getSalesPersonMana()', () => { + it('should get the mana of a salesperson of a given ticket', async() => { + let mana = await app.models.Ticket.getSalesPersonMana(1); + + expect(mana).toEqual(330); + }); + + it('should return 0 if the given ticket does not exists', async() => { + let mana = await app.models.Ticket.getSalesPersonMana(20); + + expect(mana).toEqual(0); + }); +});