feat(item and entry): add back test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
1e6805a161
commit
97a66754a7
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue