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.observation).toEqual(expectedObservation);
expect(updatedEntry.ref).toEqual(expectedRef); expect(updatedEntry.ref).toEqual(expectedRef);
expect(entryBuys.length).toEqual(2); expect(entryBuys.length).toEqual(4);
await tx.rollback(); await tx.rollback();
} catch (e) { } 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) { switch (key) {
case 'name': case 'name':
where['i.name'] = {like: `%${value}%`}; where[key] = {like: `%${value}%`};
break; break;
case 'producerFk': case 'producerFk':
case 'typeFk': case 'typeFk':

View File

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

View File

@ -41,9 +41,9 @@ class Controller extends Summary {
}); });
} }
get isTicketModule() { get isOnTicketCard() {
const path = this.$state.getCurrentPath()[1]; const currentState = this.$state.current.name;
return path.state.name === 'ticket'; return currentState.startsWith('ticket.card');
} }
get isEditable() { 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>) 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" 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" 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 title="Google Play" target="_blank" style="color: #8dba25">Android</a>, son'
href="https://www.youtube.com/watch?v=gGfEtFm8qkw" target="_blank" style="color:
#8dba25"><strong>Ver tutorial de uso</strong></a>), son'
clientId: Identificador de cliente clientId: Identificador de cliente
user: Usuario user: Usuario
password: Contraseña password: Contraseña