This commit is contained in:
parent
507bc8c2ce
commit
fb2545994c
|
@ -383,11 +383,11 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`,
|
|||
|
||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`)
|
||||
VALUES
|
||||
(1, 'T', 156.09, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), CURDATE(), 1, 1),
|
||||
(2, 'T', 208.35, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), CURDATE(), 1, 1),
|
||||
(3, 'T', 20.02, CURDATE(), 103, CURDATE(), 442, CURDATE(), NULL, 1, 1),
|
||||
(4, 'T', 20.02, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), NULL, 1, 1),
|
||||
(5, 'A', 20.22, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, DATE_ADD(CURDATE(), INTERVAL +2 MONTH), NULL, 1, 1);
|
||||
(1, 'T', 1014.24, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 101, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 1, 1),
|
||||
(2, 'T', 121.36, CURDATE(), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||
(3, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||
(4, 'T', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
|
||||
(5, 'A', 8.88, CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1);
|
||||
|
||||
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
|
||||
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;
|
||||
|
@ -397,16 +397,22 @@ UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
|
|||
|
||||
INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`)
|
||||
VALUES
|
||||
(1, 100, 10, 4722000010),
|
||||
(1, 200, 21, 4722000021),
|
||||
(2, 100, 10, 4722000010),
|
||||
(2, 200, 21, 4722000021),
|
||||
(3, 100, 10, 4722000010),
|
||||
(3, 200, 21, 4722000021),
|
||||
(4, 100, 10, 4722000010),
|
||||
(4, 200, 21, 4722000021),
|
||||
(5, 100, 10, 4722000010),
|
||||
(5, 200, 21, 4722000021);
|
||||
(1, 895.76, 89.58, 4722000010),
|
||||
(1, 33.80, 7.10, 4722000021),
|
||||
(2, 110.33, 11.03, 4770000010),
|
||||
(3, 8.07, 0.81, 4770000010),
|
||||
(4, 8.07, 0.81, 4770000010),
|
||||
(5, 8.07, 0.81, 4770000010);
|
||||
|
||||
INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount` `expenceFk` `created`)
|
||||
VALUES
|
||||
(1, 1, 813.06, 2000000000, CURDATE()),
|
||||
(2, 1, 33.80, 4751000000, CURDATE()),
|
||||
(3, 1, 70.70, 6210000567, CURDATE()),
|
||||
(4, 2, 110.33, 2000000000, CURDATE()),
|
||||
(5, 3, 8.07, 2000000000, CURDATE()),
|
||||
(6, 4, 8.07, 2000000000, CURDATE()),
|
||||
(7, 5, 8.07, 2000000000, CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`)
|
||||
VALUES
|
||||
|
|
|
@ -3,6 +3,7 @@ import createNightmare from '../../helpers/nightmare';
|
|||
|
||||
describe('InvoiceOut descriptor path', () => {
|
||||
const nightmare = createNightmare();
|
||||
let bookedDate;
|
||||
|
||||
describe('as Administrative', () => {
|
||||
beforeAll(() => {
|
||||
|
@ -113,21 +114,23 @@ describe('InvoiceOut descriptor path', () => {
|
|||
|
||||
it(`should search and access to the invoiceOut summary`, async() => {
|
||||
const url = await nightmare
|
||||
.accessToSearchResult('A1111111')
|
||||
.accessToSearchResult('T1111111')
|
||||
.waitForURL('/summary')
|
||||
.parsedUrl();
|
||||
|
||||
expect(url.hash).toContain('/summary');
|
||||
});
|
||||
|
||||
it(`should check the invoiceOut isn't booked yet in the summary data`, async() => {
|
||||
it(`should check the invoiceOut is booked in the summary data`, async() => {
|
||||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
||||
|
||||
expect(result).toEqual('-');
|
||||
bookedDate = result;
|
||||
|
||||
expect(result.length).toBeGreaterThan(1);
|
||||
});
|
||||
|
||||
it('should book the invoiceOut using the descriptor more menu', async() => {
|
||||
it('should re-book the invoiceOut using the descriptor more menu', async() => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.invoiceOutDescriptor.moreMenu)
|
||||
.waitToClick(selectors.invoiceOutDescriptor.moreMenuBookInvoiceOut)
|
||||
|
@ -141,7 +144,7 @@ describe('InvoiceOut descriptor path', () => {
|
|||
const result = await nightmare
|
||||
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');
|
||||
|
||||
expect(result.length).toBeGreaterThan(1);
|
||||
expect(result).not.toEqual(bookedDate);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -7,6 +7,6 @@ describe('Client get', () => {
|
|||
|
||||
expect(result.id).toEqual(101);
|
||||
expect(result.name).toEqual('Bruce Wayne');
|
||||
expect(result.debt).toEqual(79.05);
|
||||
expect(result.debt).toEqual(937.2);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('client getDebt()', () => {
|
|||
it('should return the client debt', async() => {
|
||||
let result = await app.models.Client.getDebt(101);
|
||||
|
||||
expect(result.debt).toEqual(79.05);
|
||||
expect(result.debt).toEqual(937.2);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('client summary()', () => {
|
|||
it('should return a summary object containing debt', async() => {
|
||||
let result = await app.models.Client.summary(101);
|
||||
|
||||
expect(result.debt.debt).toEqual(79.05);
|
||||
expect(result.debt.debt).toEqual(937.2);
|
||||
});
|
||||
|
||||
it('should return a summary object containing averageInvoiced', async() => {
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
describe('invoiceOut book()', () => {
|
||||
const invoiceOutId = 5;
|
||||
const invoiceOutId = 1;
|
||||
let invoiceOutRef;
|
||||
let OriginalInvoiceOut;
|
||||
let updatedInvoiceOut;
|
||||
let bookedDate;
|
||||
|
||||
afterAll(async done => {
|
||||
updatedInvoiceOut.updateAttributes({booked: OriginalInvoiceOut.booked, hasPdf: OriginalInvoiceOut.hasPdf});
|
||||
|
||||
|
@ -14,7 +16,9 @@ describe('invoiceOut book()', () => {
|
|||
it('should check that invoice out booked is untainted', async() => {
|
||||
const invoiceOut = await app.models.InvoiceOut.findById(invoiceOutId);
|
||||
|
||||
expect(invoiceOut.booked).toBeNull();
|
||||
bookedDate = invoiceOut.booked;
|
||||
|
||||
expect(invoiceOut.booked).toBeDefined();
|
||||
expect(invoiceOut.hasPdf).toBeTruthy();
|
||||
});
|
||||
|
||||
|
@ -26,7 +30,7 @@ describe('invoiceOut book()', () => {
|
|||
|
||||
updatedInvoiceOut = await app.models.InvoiceOut.findById(invoiceOutId);
|
||||
|
||||
expect(updatedInvoiceOut.booked).toEqual(jasmine.any(Object));
|
||||
expect(updatedInvoiceOut.booked).not.toEqual(bookedDate);
|
||||
expect(updatedInvoiceOut.hasPdf).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('InvoiceOut filter()', () => {
|
|||
it('should return the invoice out matching amount', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
amount: 208.35,
|
||||
amount: 121.36,
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -58,14 +58,14 @@ describe('InvoiceOut filter()', () => {
|
|||
it('should return the invoice out matching min and max', async() => {
|
||||
let ctx = {
|
||||
args: {
|
||||
min: 100,
|
||||
max: 300,
|
||||
min: 0,
|
||||
max: 100,
|
||||
}
|
||||
};
|
||||
|
||||
let result = await app.models.InvoiceOut.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(2);
|
||||
expect(result.length).toEqual(3);
|
||||
});
|
||||
|
||||
// #1428 cuadrar formato de horas
|
||||
|
|
Loading…
Reference in New Issue