feat: refs #6276 WIP test sectorCollection_getSales
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
08dd37e9e4
commit
ae89d59bde
|
@ -1,6 +1,6 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
fdescribe('collection getSalesFromTicketOrCollection()', () => {
|
||||
describe('collection getSalesFromTicketOrCollection()', () => {
|
||||
const collectionOrTicketFk = 999999;
|
||||
const print = true;
|
||||
const source = 'CHECKER';
|
||||
|
@ -15,21 +15,45 @@ fdescribe('collection getSalesFromTicketOrCollection()', () => {
|
|||
});
|
||||
|
||||
it('should return a collection with tickets, placements and barcodes settled correctly', async() => {
|
||||
const options = {};
|
||||
const collection = await models.Collection.getSalesFromTicketOrCollection(ctx,
|
||||
collectionOrTicketFk, print, source, options);
|
||||
const tx = await models.Collection.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
try {
|
||||
const collection = await models.Collection.getSalesFromTicketOrCollection(ctx,
|
||||
collectionOrTicketFk, print, source, options);
|
||||
|
||||
const [firstTicket] = collection.tickets;
|
||||
const [firstSale] = firstTicket.sales;
|
||||
const [firstPlacement] = firstSale.placements;
|
||||
const [firstTicket] = collection.tickets;
|
||||
const [firstSale] = firstTicket.sales;
|
||||
const [firstPlacement] = firstSale.placements;
|
||||
|
||||
expect(collection.tickets.length).toBeGreaterThan(0);
|
||||
expect(collection.collectionFk).toEqual(firstTicket.ticketFk);
|
||||
expect(collection.tickets.length).toBeTruthy();
|
||||
expect(collection.collectionFk).toEqual(firstTicket.ticketFk);
|
||||
|
||||
expect(firstSale.ticketFk).toEqual(firstTicket.ticketFk);
|
||||
expect(firstSale.placements.length).toBeGreaterThan(0);
|
||||
expect(firstSale.barcodes.length).toBeGreaterThan(0);
|
||||
expect(firstSale.ticketFk).toEqual(firstTicket.ticketFk);
|
||||
expect(firstSale.placements.length).toBeTruthy();
|
||||
expect(firstSale.barcodes.length).toBeTruthy();
|
||||
|
||||
expect(firstSale.saleFk).toEqual(firstPlacement.saleFk);
|
||||
expect(firstSale.saleFk).toEqual(firstPlacement.saleFk);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should print a sticker', async() => {
|
||||
const tx = await models.Collection.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
try {
|
||||
const printQueueBefore = await models.Collection.rawSql('SELECT * FROM printQueue', [], options);
|
||||
await models.Collection.getSalesFromTicketOrCollection(ctx,
|
||||
collectionOrTicketFk, print, source, options);
|
||||
const printQueueAfter = await models.Collection.rawSql('SELECT * FROM printQueue', [], options);
|
||||
|
||||
expect(printQueueAfter.length).toEqual(printQueueBefore.length + 1);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3713,4 +3713,4 @@ UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
|
|||
|
||||
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
|
||||
|
||||
INSERT INTO vn.report (name) VALUES ('LabelCollection')
|
||||
INSERT INTO vn.report (name) VALUES ('LabelCollection');
|
Loading…
Reference in New Issue