feat: updated backTest
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
a9badfc1ba
commit
f6ab9d8a31
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
if (!geoIds.lenght) throw new Error(`You must select a location`);
|
if (!geoIds[0]) throw new UserError(`You must select a location`);
|
||||||
|
|
||||||
const newZoneExclusion = await models.ZoneExclusion.create({
|
const newZoneExclusion = await models.ZoneExclusion.create({
|
||||||
zoneFk: zoneFk,
|
zoneFk: zoneFk,
|
||||||
|
|
|
@ -1,6 +1,27 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('zone exclusionGeo()', () => {
|
describe('zone exclusionGeo()', () => {
|
||||||
|
it(`should show an error when location isn't selected`, async() => {
|
||||||
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const today = new Date();
|
||||||
|
const zoneId = 1;
|
||||||
|
const geoIds = [];
|
||||||
|
const result = await models.Zone.exclusionGeo(zoneId, today, geoIds, options);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(2);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toContain(`You must select a location`);
|
||||||
|
});
|
||||||
|
|
||||||
it('should create two exclusion by geo', async() => {
|
it('should create two exclusion by geo', async() => {
|
||||||
const tx = await models.Zone.beginTransaction({});
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue