This commit is contained in:
Ainki 2020-03-26 19:10:09 +01:00 committed by Joan Sanchez
parent 07d952646a
commit fceee0a9d6
6 changed files with 47 additions and 3 deletions

View File

@ -1,5 +1,5 @@
module.exports = Self => { module.exports = Self => {
Self.remoteMethodCtx('getSectors', { Self.remoteMethod('getSectors', {
description: 'Get all sectors', description: 'Get all sectors',
accessType: 'READ', accessType: 'READ',
returns: { returns: {
@ -12,9 +12,9 @@ module.exports = Self => {
} }
}); });
Self.getSectors = async ctx => { Self.getSectors = async() => {
const query = `CALL vn.sector_get()`; const query = `CALL vn.sector_get()`;
const [result] = await Self.rawSql(query, []); const [result] = await Self.rawSql(query);
return result; return result;
}; };
}; };

View File

@ -0,0 +1,8 @@
describe('collectionFaults()', () => {
it('return shelving afected', async() => {
let val = 2;
expect(val).toBeGreaterThan(1);
});
});

View File

@ -0,0 +1,10 @@
const app = require('vn-loopback/server/server');
describe('getCollection()', () => {
it('return list of collection', async() => {
let ctx = {req: {accessToken: {userId: 1}}};
let response = await app.models.Collection.getCollection(ctx);
expect(response.length).toEqual(0);
});
});

View File

@ -0,0 +1,9 @@
const app = require('vn-loopback/server/server');
describe('getSectors()', () => {
it('return list of sectors', async() => {
let response = await app.models.Collection.getSectors();
expect(response.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,10 @@
const app = require('vn-loopback/server/server');
describe('newCollection()', () => {
it('return a new collection', async() => {
let ctx = {req: {accessToken: {userId: 1}}};
let response = await app.models.Collection.newCollection(ctx, 500, 1, 1);
expect(response.length).toBeGreaterThan(0);
});
});

View File

@ -0,0 +1,7 @@
describe('updateCollectionSale()', () => {
it('return a collection updated', async() => {
let val = 2;
expect(val).toBeGreaterThan(1);
});
});