refactor(jasmine): usage of done on async functions is deprecated
This commit is contained in:
parent
f1611f8fe0
commit
580ba36357
|
@ -8,12 +8,10 @@ describe('client canBeInvoiced()', () => {
|
|||
accessToken: {userId: userId}
|
||||
};
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return falsy for a client without the data checked', async() => {
|
||||
|
|
|
@ -4,13 +4,11 @@ describe('loopback model address', () => {
|
|||
let createdAddressId;
|
||||
const clientId = 1101;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
let client = await app.models.Client.findById(clientId);
|
||||
|
||||
await app.models.Address.destroyById(createdAddressId);
|
||||
await client.updateAttribute('isEqualizated', false);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
describe('observe()', () => {
|
||||
|
|
|
@ -10,12 +10,10 @@ describe('entry import()', () => {
|
|||
accessToken: {userId: buyerId},
|
||||
};
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should import the buy rows', async() => {
|
||||
|
|
|
@ -3,12 +3,10 @@ const LoopBackContext = require('loopback-context');
|
|||
|
||||
describe('entry importBuysPreview()', () => {
|
||||
const entryId = 1;
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return the buys with the calculated packageFk', async() => {
|
||||
|
|
|
@ -3,10 +3,8 @@ const app = require('vn-loopback/server/server');
|
|||
describe('order addToOrder()', () => {
|
||||
const orderId = 8;
|
||||
let rowToDelete;
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
await app.models.OrderRow.removes({rows: [rowToDelete], actualOrderId: orderId});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should add a row to a given order', async() => {
|
||||
|
|
|
@ -4,12 +4,10 @@ describe('order removes()', () => {
|
|||
let row;
|
||||
let newRow;
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
row = await app.models.OrderRow.findOne({where: {id: 12}});
|
||||
row.id = null;
|
||||
newRow = await app.models.OrderRow.create(row);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should throw an error if rows property is empty', async() => {
|
||||
|
|
|
@ -4,10 +4,8 @@ let UserError = require('vn-loopback/util/user-error');
|
|||
describe('order new()', () => {
|
||||
let orderId;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
await app.models.Order.destroyById(orderId);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should throw an error if the client isnt active', async() => {
|
||||
|
|
|
@ -2,12 +2,10 @@ const app = require('vn-loopback/server/server');
|
|||
|
||||
describe('Order updateBasicData', () => {
|
||||
const orderId = 21;
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
let validparams = {note: null};
|
||||
|
||||
await app.models.Order.updateBasicData(orderId, validparams);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return an error if the order is confirmed', async() => {
|
||||
|
|
|
@ -4,14 +4,12 @@ describe('route guessPriority()', () => {
|
|||
const targetRouteId = 7;
|
||||
let routeTicketsToRestore;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
let restoreFixtures = [];
|
||||
routeTicketsToRestore.forEach(ticket => {
|
||||
restoreFixtures.push(ticket.updateAttribute('priority', null));
|
||||
});
|
||||
await Promise.all(restoreFixtures);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should call guessPriority() and then check the tickets in the target route now have their priorities defined', async() => {
|
||||
|
|
|
@ -8,12 +8,10 @@ describe('route insertTicket()', () => {
|
|||
accessToken: {userId: deliveryId},
|
||||
};
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should add the ticket to a route', async() => {
|
||||
|
|
|
@ -4,18 +4,14 @@ describe('loopback model Supplier', () => {
|
|||
let supplierOne;
|
||||
let supplierTwo;
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
supplierOne = await app.models.Supplier.findById(1);
|
||||
supplierTwo = await app.models.Supplier.findById(442);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
await supplierOne.updateAttribute('payMethodFk', supplierOne.payMethodFk);
|
||||
await supplierTwo.updateAttribute('payMethodFk', supplierTwo.payMethodFk);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
describe('payMethodFk', () => {
|
||||
|
|
|
@ -30,12 +30,10 @@ describe('ticket changeState()', () => {
|
|||
agencyModeFk: 7
|
||||
};
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should throw if the ticket is not editable and the user isnt production', async() => {
|
||||
|
|
|
@ -7,11 +7,10 @@ describe('ticket setDelivered()', () => {
|
|||
accessToken: {userId: userId},
|
||||
};
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return the state which has been applied to the given tickets', async() => {
|
||||
|
|
|
@ -8,12 +8,10 @@ describe('ticket canBeInvoiced()', () => {
|
|||
accessToken: {userId: userId}
|
||||
};
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should return falsy for an already invoiced ticket', async() => {
|
||||
|
|
|
@ -11,12 +11,10 @@ describe('ticket makeInvoice()', () => {
|
|||
};
|
||||
const ctx = {req: activeCtx};
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should throw an error when invoicing tickets from multiple clients', async() => {
|
||||
|
|
|
@ -3,10 +3,8 @@ const app = require('vn-loopback/server/server');
|
|||
describe('ticket model TicketTracking', () => {
|
||||
let ticketTrackingId;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
await app.models.TicketPackaging.destroyById(ticketTrackingId);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should save a ticketTraing as the quantity is greater than 0', async() => {
|
||||
|
|
|
@ -9,7 +9,7 @@ xdescribe('Travel cloneWithEntries()', () => {
|
|||
let travelBefore;
|
||||
let newTravelId;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
try {
|
||||
const entries = await models.Entry.find({
|
||||
where: {
|
||||
|
@ -44,8 +44,6 @@ xdescribe('Travel cloneWithEntries()', () => {
|
|||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it(`should clone the travel and the containing entries`, async() => {
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('Travel deleteThermograph()', () => {
|
|||
const ctx = {req: {accessToken: {userId: currentUserId}}};
|
||||
let travelThermographBefore;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
await app.models.TravelThermograph.rawSql(`
|
||||
UPDATE travelThermograph
|
||||
SET travelFk = ?, dmsFk = ?
|
||||
|
@ -19,8 +19,6 @@ describe('Travel deleteThermograph()', () => {
|
|||
travelThermographBefore.dmsFk,
|
||||
travelThermographBefore.id
|
||||
]);
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it(`should set the travelFk and dmsFk properties to null for travel thermograph removal`, async() => {
|
||||
|
|
|
@ -3,9 +3,8 @@ const app = require('vn-loopback/server/server');
|
|||
describe('department createChild()', () => {
|
||||
let createdChild;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
await createdChild.destroy();
|
||||
done();
|
||||
});
|
||||
|
||||
it('should create a new child', async() => {
|
||||
|
|
|
@ -3,10 +3,9 @@ const app = require('vn-loopback/server/server');
|
|||
describe('department moveChild()', () => {
|
||||
let updatedChild;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
const child = await app.models.Department.findById(updatedChild.id);
|
||||
await child.updateAttribute('parentFk', null);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should move a child department to a new parent', async() => {
|
||||
|
|
|
@ -3,9 +3,8 @@ const app = require('vn-loopback/server/server');
|
|||
describe('department removeChild()', () => {
|
||||
let removedChild;
|
||||
|
||||
afterAll(async done => {
|
||||
afterAll(async() => {
|
||||
await app.models.Department.create(removedChild);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should remove a child department', async() => {
|
||||
|
|
|
@ -11,7 +11,7 @@ describe('zone deletezone()', () => {
|
|||
let ticketIDs;
|
||||
let originalTicketStates;
|
||||
|
||||
beforeAll(async done => {
|
||||
beforeAll(async() => {
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
@ -28,8 +28,6 @@ describe('zone deletezone()', () => {
|
|||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
done();
|
||||
});
|
||||
|
||||
it('should delete a zone and update their tickets', async() => {
|
||||
|
|
Loading…
Reference in New Issue