7729-devToTest_2430 #2739
|
@ -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('setSaleQuantity()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should change quantity sale', async() => {
|
||||
|
|
|
@ -1,22 +1,14 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
// const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('getStarredModules()', () => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
const ctx = {req: activeCtx};
|
||||
const {ctx} = beforeAll;
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
});
|
||||
// beforeEach(() => {
|
||||
// spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
// active: ctx
|
||||
// });
|
||||
// });
|
||||
|
||||
it(`should return the starred modules for a given user`, async() => {
|
||||
const newStarred = await models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1});
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
// const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('setPosition()', () => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
const ctx = {
|
||||
req: activeCtx
|
||||
};
|
||||
const {ctx} = beforeAll;
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
});
|
||||
// beforeEach(() => {
|
||||
// spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
// active: activeCtx
|
||||
// });
|
||||
// });
|
||||
|
||||
it('should increase the orders module position by replacing it with clients and vice versa', async() => {
|
||||
const tx = await models.StarredModule.beginTransaction({});
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
// const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('toggleStarredModule()', () => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
const ctx = {
|
||||
req: activeCtx
|
||||
};
|
||||
const {ctx} = beforeAll;
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
});
|
||||
// beforeEach(() => {
|
||||
// spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
// active: activeCtx
|
||||
// });
|
||||
// });
|
||||
|
||||
it('should create a new starred module and then remove it by calling the method again with same args', async() => {
|
||||
const starredModule = await models.StarredModule.toggleStarredModule(ctx, 'order');
|
||||
|
@ -26,7 +16,7 @@ describe('toggleStarredModule()', () => {
|
|||
|
||||
expect(starredModules.length).toEqual(1);
|
||||
expect(starredModule.moduleFk).toEqual('order');
|
||||
expect(starredModule.workerFk).toEqual(activeCtx.accessToken.userId);
|
||||
expect(starredModule.workerFk).toEqual(ctx.req.accessToken.userId);
|
||||
expect(starredModule.position).toEqual(starredModules.length);
|
||||
|
||||
await models.StarredModule.toggleStarredModule(ctx, 'order');
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"vn": {
|
||||
"view": {
|
||||
"expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb"
|
||||
"expeditionPallet_Print": "06613719475fcdba8309607c38cc78efc2e348cca7bc96b48dc3ae3c12426f54"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,9 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('Model crud()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
let insertId;
|
||||
const barcodeModel = app.models.ItemBarcode;
|
||||
|
|
|
@ -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('Model rewriteDbError()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should extend rewriteDbError properties to any model passed', () => {
|
||||
|
|
|
@ -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('Buy editLatestsBuys()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should change the value of a given column for the selected buys', async() => {
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
const LoopBackContext = require('loopback-context');
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
const {mockLoopBackContext} = require('vn-loopback/../../back/vn-jasmine');
|
||||
|
||||
describe('invoiceInDueDay new()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
it('should correctly create a new due day', 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('loopback model Supplier', () => {
|
||||
let supplierOne;
|
||||
|
@ -8,18 +8,7 @@ describe('loopback model Supplier', () => {
|
|||
beforeAll(async() => {
|
||||
supplierOne = await models.Supplier.findById(1);
|
||||
supplierTwo = await models.Supplier.findById(442);
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
describe('payMethodFk', () => {
|
||||
|
|
|
@ -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('Travel createThermograph()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
const travelId = 3;
|
||||
const currentUserId = 1102;
|
||||
|
|
|
@ -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('Worker new', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
http: {
|
||||
req: {
|
||||
headers: {origin: 'http://localhost'}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
mockLoopBackContext();
|
||||
});
|
||||
|
||||
const employeeId = 1;
|
||||
|
|
Loading…
Reference in New Issue