refs #5528 feat: add back test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-06-14 13:05:46 +02:00
parent 65108943ab
commit 98b270b885
1 changed files with 30 additions and 1 deletions

View File

@ -53,7 +53,36 @@ describe('Buy editLatestsBuys()', () => {
const options = {transaction: tx};
try {
const filter = {'categoryFk': 1};
const filter = {'categoryFk': 1, 'tags': []};
const ctx = {
args: {
filter: filter
},
req: {accessToken: {userId: 1}}
};
const field = 'size';
const newValue = 88;
await models.Buy.editLatestBuys(ctx, field, newValue, null, filter, options);
const [result] = await models.Buy.latestBuysFilter(ctx, null, options);
expect(result[field]).toEqual(newValue);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should change the value of a given column for filter tags', async() => {
const tx = await models.Buy.beginTransaction({});
const options = {transaction: tx};
try {
const filter = {'tags': [{tagFk: 1, value: 'Brown'}]};
const ctx = {
args: {
filter: filter