Updated unit tests
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2022-01-31 12:27:42 +01:00
parent 78507240ee
commit e618423ef8
6 changed files with 33 additions and 9 deletions

View File

@ -59,7 +59,7 @@ describe('entry import()', () => {
expect(updatedEntry.observation).toEqual(expectedObservation);
expect(updatedEntry.ref).toEqual(expectedRef);
expect(entryBuys.length).toEqual(2);
expect(entryBuys.length).toEqual(4);
await tx.rollback();
} catch (e) {

View File

@ -0,0 +1,26 @@
const models = require('vn-loopback/server/server').models;
describe('Entry lastItemBuys()', () => {
const entryId = 3;
it('should return the items that have been bought', async() => {
const filter = {where: {}};
const result = await models.Entry.lastItemBuys(entryId, filter);
expect(result.length).toBeGreaterThan(1);
});
it('should return the items matching color "brown"', async() => {
const brownInkCode = 'BRW';
const filter = {where: {inkFk: brownInkCode}};
const result = await models.Entry.lastItemBuys(entryId, filter);
expect(result.length).toEqual(2);
});
it('should return the items with a name containing "Ranged"', async() => {
const filter = {where: {name: {like: '%Ranged%'}}};
const result = await models.Entry.lastItemBuys(entryId, filter);
expect(result.length).toEqual(3);
});
});

View File

@ -128,7 +128,7 @@ class Controller extends Section {
switch (key) {
case 'name':
where['i.name'] = {like: `%${value}%`};
where[key] = {like: `%${value}%`};
break;
case 'producerFk':
case 'typeFk':

View File

@ -20,7 +20,7 @@
on-change="$ctrl.changeState(value)">
</vn-button-menu>
<vn-ticket-descriptor-menu
ng-if="!$ctrl.isTicketModule"
ng-if="!$ctrl.isOnTicketCard"
ticket-id="$ctrl.summary.id"
parent-reload="$ctrl.reload()"
/>

View File

@ -41,9 +41,9 @@ class Controller extends Summary {
});
}
get isTicketModule() {
const path = this.$state.getCurrentPath()[1];
return path.state.name === 'ticket';
get isOnTicketCard() {
const currentState = this.$state.current.name;
return currentState.startsWith('ticket.card');
}
get isEditable() {

View File

@ -5,9 +5,7 @@ clientData: 'Tus datos para poder comprar en la web de Verdnatura (<a href="http
title="Visitar Verdnatura" target="_blank" style="color: #8dba25">https://www.verdnatura.es</a>)
o en nuestras aplicaciones para <a href="https://goo.gl/3hC2mG" title="App Store"
target="_blank" style="color: #8dba25">iOS</a> y <a href="https://goo.gl/8obvLc"
title="Google Play" target="_blank" style="color: #8dba25">Android</a> (<a
href="https://www.youtube.com/watch?v=gGfEtFm8qkw" target="_blank" style="color:
#8dba25"><strong>Ver tutorial de uso</strong></a>), son'
title="Google Play" target="_blank" style="color: #8dba25">Android</a>, son'
clientId: Identificador de cliente
user: Usuario
password: Contraseña