diff --git a/services/loopback/common/methods/workerMana/specs/getCurrentWorkerMana.spec.js b/services/loopback/common/methods/workerMana/specs/getCurrentWorkerMana.spec.js new file mode 100644 index 000000000..0eb28a8bd --- /dev/null +++ b/services/loopback/common/methods/workerMana/specs/getCurrentWorkerMana.spec.js @@ -0,0 +1,15 @@ +const app = require(`${servicesDir}/ticket/server/server`); + +describe('workerMana getCurrentWorkerMana()', () => { + it('should get the mana of the logged worker', async() => { + let mana = await app.models.WorkerMana.getCurrentWorkerMana({req: {accessToken: {userId: 18}}}); + + expect(mana).toEqual(330); + }); + + it('should return 0 if the user doesnt uses mana', async() => { + let mana = await app.models.WorkerMana.getCurrentWorkerMana({req: {accessToken: {userId: 9}}}); + + expect(mana).toEqual(0); + }); +});