feat(item and entry): add back test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2021-11-22 08:58:54 +01:00
parent 1e6805a161
commit 97a66754a7
2 changed files with 52 additions and 0 deletions

View File

@ -136,5 +136,17 @@ describe('Buy latests buys filter()', () => {
expect(results.length).toBe(1);
});
it('should return results matching "supplierFk"', async() => {
let ctx = {
args: {
supplierFk: 1
}
};
let results = await app.models.Buy.latestBuysFilter(ctx);
expect(results.length).toBe(2);
});
});

View File

@ -79,4 +79,44 @@ describe('item filter()', () => {
throw e;
}
});
it('should return 2 result filtering by buyerFk', async() => {
const tx = await models.Item.beginTransaction({});
const options = {transaction: tx};
try {
const filter = {};
const ctx = {args: {filter: filter, buyerFk: 16}};
const result = await models.Item.filter(ctx, filter, options);
expect(result.length).toEqual(2);
expect(result[0].id).toEqual(16);
expect(result[1].id).toEqual(71);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return 2 result filtering by supplierFk', async() => {
const tx = await models.Item.beginTransaction({});
const options = {transaction: tx};
try {
const filter = {};
const ctx = {args: {filter: filter, supplierFk: 1}};
const result = await models.Item.filter(ctx, filter, options);
expect(result.length).toEqual(2);
expect(result[0].id).toEqual(1);
expect(result[1].id).toEqual(3);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});