This commit is contained in:
parent
b3fa869757
commit
093eaeb475
|
@ -1,20 +1,9 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('Client addressesPropagateRe', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should propagate the isEqualizated on both addresses of Mr Wayne and set hasToInvoiceByAddress to false', async() => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('Address createAddress', () => {
|
||||
const clientFk = 1101;
|
||||
|
@ -8,18 +8,7 @@ describe('Address createAddress', () => {
|
|||
const customAgentOneId = 1;
|
||||
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should throw a non uee member error if no incoterms is defined', async() => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('Address updateAddress', () => {
|
||||
const clientId = 1101;
|
||||
|
@ -15,18 +15,7 @@ describe('Address updateAddress', () => {
|
|||
};
|
||||
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should throw the non uee member error if no incoterms is defined', async() => {
|
||||
|
|
|
@ -1,23 +1,12 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('loopback model address', () => {
|
||||
let createdAddressId;
|
||||
const clientId = 1101;
|
||||
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('upsertFixedPrice()', () => {
|
||||
const now = Date.vnNew();
|
||||
|
@ -8,17 +8,7 @@ describe('upsertFixedPrice()', () => {
|
|||
|
||||
beforeAll(async() => {
|
||||
originalFixedPrice = await models.FixedPrice.findById(fixedPriceId);
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it(`should toggle the hasMinPrice boolean if there's a minPrice and update the rest of the data`, async() => {
|
||||
|
|
|
@ -1,20 +1,10 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('item clone()', () => {
|
||||
let nextItemId;
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
beforeEach(async() => {
|
||||
|
|
|
@ -2,17 +2,14 @@ const models = require('vn-loopback/server/server').models;
|
|||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('item getBalance()', () => {
|
||||
const ctx = {req: {accessToken: {userId: 9}}};
|
||||
const {ctx} = beforeAll;
|
||||
it('should return the balance lines of a client type loses in which one has highlighted true', async() => {
|
||||
const tx = await models.Item.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
try {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
active: ctx
|
||||
});
|
||||
const losesClientId = 1111;
|
||||
const ticket = await models.Ticket.findById(7, null, options);
|
||||
|
|
|
@ -1,20 +1,9 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('item new()', () => {
|
||||
const ctx = {req: {accessToken: {userId: 9}}};
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should create a new item, adding the name as a tag', async() => {
|
||||
|
|
|
@ -1,19 +1,9 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('item updateTaxes()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should throw an error if the taxClassFk is blank', async() => {
|
||||
|
|
|
@ -1,19 +1,9 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('agency clone()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should clone a zone', async() => {
|
||||
|
|
|
@ -1,19 +1,9 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('zone exclusionGeo()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
const zoneId = 1;
|
||||
const today = Date.vnNew();
|
||||
|
|
|
@ -1,18 +1,9 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('zone toggleIsIncluded()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should return the created location with isIncluded true', async() => {
|
||||
|
|
Loading…
Reference in New Issue