fix: backTest
gitea/salix/pipeline/head This commit is unstable
Details
gitea/salix/pipeline/head This commit is unstable
Details
This commit is contained in:
parent
605da52286
commit
840e792d13
|
@ -9,7 +9,8 @@ describe('Buy editLatestsBuys()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
search: 'Ranged weapon longbow 2m'
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const [original] = await models.Buy.latestBuysFilter(ctx, null, options);
|
||||
|
@ -40,7 +41,8 @@ describe('Buy editLatestsBuys()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
filter: filter
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const field = 'size';
|
||||
|
|
|
@ -9,13 +9,14 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
search: 'Ranged weapon longbow 2m'
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
const firstBuy = results[0];
|
||||
|
||||
expect(results.length).toEqual(3);
|
||||
expect(results.length).toEqual(1);
|
||||
expect(firstBuy.size).toEqual(70);
|
||||
|
||||
await tx.rollback();
|
||||
|
@ -33,12 +34,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
id: 1
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toEqual(3);
|
||||
expect(results.length).toEqual(1);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -57,12 +59,13 @@ describe('Entry latests buys filter()', () => {
|
|||
tags: [
|
||||
{tagFk: 27, value: '2m'}
|
||||
]
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(4);
|
||||
expect(results.length).toBe(2);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -79,12 +82,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
categoryFk: 1
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(7);
|
||||
expect(results.length).toBe(4);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -101,12 +105,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
typeFk: 2
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(7);
|
||||
expect(results.length).toBe(4);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -123,12 +128,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
active: true
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(12);
|
||||
expect(results.length).toBe(6);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -145,7 +151,8 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
active: false
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
@ -167,12 +174,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
visible: true
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(11);
|
||||
expect(results.length).toBe(5);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -189,7 +197,8 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
visible: false
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
@ -211,7 +220,8 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
floramondo: true
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
@ -233,12 +243,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
floramondo: false
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(11);
|
||||
expect(results.length).toBe(5);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -255,12 +266,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
salesPersonFk: 35
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(12);
|
||||
expect(results.length).toBe(6);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -277,12 +289,13 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
description: 'Increases block'
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
||||
expect(results.length).toBe(4);
|
||||
expect(results.length).toBe(1);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -299,7 +312,8 @@ describe('Entry latests buys filter()', () => {
|
|||
const ctx = {
|
||||
args: {
|
||||
supplierFk: 1
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
@ -328,7 +342,8 @@ describe('Entry latests buys filter()', () => {
|
|||
args: {
|
||||
from: from,
|
||||
to: to
|
||||
}
|
||||
},
|
||||
req: {accessToken: {userId: 1}}
|
||||
};
|
||||
|
||||
const results = await models.Buy.latestBuysFilter(ctx, options);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('item filter()', () => {
|
||||
it('should return 3 result filtering by id', async() => {
|
||||
it('should return 1 result filtering by id', async() => {
|
||||
const tx = await models.Item.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const filter = {};
|
||||
const ctx = {args: {filter: filter, search: 1}};
|
||||
const ctx = {args: {filter: filter, search: 1}, req: {accessToken: {userId: 1}}};
|
||||
const result = await models.Item.filter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(3);
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].id).toEqual(1);
|
||||
|
||||
await tx.rollback();
|
||||
|
@ -20,16 +20,16 @@ describe('item filter()', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it('should return 2 result filtering by barcode', async() => {
|
||||
it('should return 1 result filtering by barcode', async() => {
|
||||
const tx = await models.Item.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const filter = {};
|
||||
const ctx = {args: {filter: filter, search: 4444444444}};
|
||||
const ctx = {args: {filter: filter, search: 4444444444}, req: {accessToken: {userId: 1}}};
|
||||
const result = await models.Item.filter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result[0].id).toEqual(2);
|
||||
|
||||
await tx.rollback();
|
||||
|
@ -49,7 +49,7 @@ describe('item filter()', () => {
|
|||
limit: 8
|
||||
};
|
||||
const tags = [{value: 'medical box', tagFk: 58}];
|
||||
const ctx = {args: {filter: filter, typeFk: 5, tags: tags}};
|
||||
const ctx = {args: {filter: filter, typeFk: 5, tags: tags}, req: {accessToken: {userId: 1}}};
|
||||
const result = await models.Item.filter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
|
@ -67,7 +67,7 @@ describe('item filter()', () => {
|
|||
|
||||
try {
|
||||
const filter = {};
|
||||
const ctx = {args: {filter: filter, isFloramondo: true}};
|
||||
const ctx = {args: {filter: filter, isFloramondo: true}, req: {accessToken: {userId: 1}}};
|
||||
const result = await models.Item.filter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(3);
|
||||
|
@ -86,7 +86,7 @@ describe('item filter()', () => {
|
|||
|
||||
try {
|
||||
const filter = {};
|
||||
const ctx = {args: {filter: filter, buyerFk: 16}};
|
||||
const ctx = {args: {filter: filter, buyerFk: 16}, req: {accessToken: {userId: 1}}};
|
||||
const result = await models.Item.filter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
|
@ -106,7 +106,7 @@ describe('item filter()', () => {
|
|||
|
||||
try {
|
||||
const filter = {};
|
||||
const ctx = {args: {filter: filter, supplierFk: 1}};
|
||||
const ctx = {args: {filter: filter, supplierFk: 1}, req: {accessToken: {userId: 1}}};
|
||||
const result = await models.Item.filter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
|
|
Loading…
Reference in New Issue