jasmine reporters config for CI
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Jimenez Ruiz 2022-05-12 11:43:41 +02:00
parent 833addcb75
commit cce1d93dde
8 changed files with 74 additions and 60 deletions

14
Jenkinsfile vendored
View File

@ -62,13 +62,13 @@ pipeline {
} }
} }
} }
// stage('Backend') { stage('Backend') {
// steps { steps {
// nodejs('node-v14') { nodejs('node-v14') {
// sh 'gulp launchBackTest --ci' sh 'npm run test:back ci'
// } }
// } }
// } }
} }
} }
stage('Build') { stage('Build') {

View File

@ -1,8 +1,8 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
// #3400 analizar que hacer con rutas de back colletion describe('newCollection()', () => {
xdescribe('newCollection()', () => { it('should return a new collection', async() => {
it('return a new collection', async() => { pending('#3400 analizar que hacer con rutas de back collection');
let ctx = {req: {accessToken: {userId: 1106}}}; let ctx = {req: {accessToken: {userId: 1106}}};
let response = await app.models.Collection.newCollection(ctx, 1, 1, 1); let response = await app.models.Collection.newCollection(ctx, 1, 1, 1);

View File

@ -10,7 +10,7 @@ process.on('warning', warning => {
async function test() { async function test() {
let verbose = false; let verbose = false;
if (process.argv[2] === '--v') if (process.argv[2] === 'ci')
verbose = true; verbose = true;
const container = new Docker(); const container = new Docker();
@ -40,16 +40,20 @@ async function test() {
jasmine.loadConfig({ jasmine.loadConfig({
spec_dir: '.', spec_dir: '.',
spec_files: backSpecs, spec_files: backSpecs,
helpers: [], helpers: []
}); });
jasmine.addReporter(new SpecReporter({ jasmine.addReporter(new SpecReporter({
spec: { spec: {
displaySuccessful: verbose, displaySuccessful: verbose,
displayPending: verbose
},
summary: {
displayPending: false,
} }
})); }));
jasmine.exitOnCompletion = false, jasmine.exitOnCompletion = false;
await jasmine.execute(); await jasmine.execute();
if (app) await app.disconnect(); if (app) await app.disconnect();
if (container) await container.rm(); if (container) await container.rm();

View File

@ -12,11 +12,13 @@ describe('Client updatePortfolio', () => {
const expectedResult = 841.63; const expectedResult = 841.63;
await models.Client.rawSql(`UPDATE vn.client SET salesPersonFk = ${salesPersonId} WHERE id = ${clientId}; `); const clientQuery = `UPDATE vn.client SET salesPersonFk = ${salesPersonId} WHERE id = ${clientId}; `;
await models.Client.rawSql(clientQuery);
await models.Client.updatePortfolio(); await models.Client.updatePortfolio();
let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options); const portfolioQuery = `SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `;
const [salesPerson] = await models.Client.rawSql(portfolioQuery, null, options);
expect(salesPerson.portfolioWeight).toEqual(expectedResult); expect(salesPerson.portfolioWeight).toEqual(expectedResult);
@ -26,8 +28,9 @@ describe('Client updatePortfolio', () => {
throw e; throw e;
} }
}); });
// task 3817
xit('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => { it('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => {
pending('task 3817');
const salesPersonId = 19; const salesPersonId = 19;
const tx = await models.Client.beginTransaction({}); const tx = await models.Client.beginTransaction({});
@ -40,7 +43,8 @@ describe('Client updatePortfolio', () => {
await models.Client.updatePortfolio(); await models.Client.updatePortfolio();
let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options); const portfolioQuery = `SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `;
const [salesPerson] = await models.Client.rawSql(portfolioQuery, null, options);
expect(salesPerson.portfolioWeight).toEqual(expectedResult); expect(salesPerson.portfolioWeight).toEqual(expectedResult);

View File

@ -1,7 +1,6 @@
const models = require('vn-loopback/server/server').models; const models = require('vn-loopback/server/server').models;
// Include after #3638 export database describe('AgencyTerm createInvoiceIn()', () => {
xdescribe('AgencyTerm createInvoiceIn()', () => {
const rows = [ const rows = [
{ {
routeFk: 2, routeFk: 2,
@ -17,6 +16,7 @@ xdescribe('AgencyTerm createInvoiceIn()', () => {
]; ];
it('should make an invoiceIn', async() => { it('should make an invoiceIn', async() => {
pending('Include after #3638 export database');
const tx = await models.AgencyTerm.beginTransaction({}); const tx = await models.AgencyTerm.beginTransaction({});
const options = {transaction: tx}; const options = {transaction: tx};
@ -32,8 +32,12 @@ xdescribe('AgencyTerm createInvoiceIn()', () => {
await models.AgencyTerm.createInvoiceIn(rows, dms, options); await models.AgencyTerm.createInvoiceIn(rows, dms, options);
const [newInvoiceIn] = await models.InvoiceIn.rawSql('SELECT MAX(id) id FROM invoiceIn', null, options); const [newInvoiceIn] = await models.InvoiceIn.rawSql('SELECT MAX(id) id FROM invoiceIn', null, options);
const [newInvoiceInDueDay] = await models.InvoiceInDueDay.rawSql('SELECT MAX(id) id FROM invoiceInDueDay', null, options);
const [newInvoiceInTax] = await models.InvoiceInTax.rawSql('SELECT MAX(id) id FROM invoiceInTax', null, options); const dueDayQuery = 'SELECT MAX(id) id FROM invoiceInDueDay';
const [newInvoiceInDueDay] = await models.InvoiceInDueDay.rawSql(dueDayQuery, null, options);
const taxQuery = 'SELECT MAX(id) id FROM invoiceInTax';
const [newInvoiceInTax] = await models.InvoiceInTax.rawSql(taxQuery, null, options);
expect(newInvoiceIn.id).toBeGreaterThan(oldInvoiceIn.id); expect(newInvoiceIn.id).toBeGreaterThan(oldInvoiceIn.id);
expect(newInvoiceInDueDay.id).toBeGreaterThan(oldInvoiceInDueDay.id); expect(newInvoiceInDueDay.id).toBeGreaterThan(oldInvoiceInDueDay.id);

View File

@ -28,8 +28,9 @@ describe('ticket setDeleted()', () => {
expect(error.message).toEqual('You must delete the claim id %d first'); expect(error.message).toEqual('You must delete the claim id %d first');
}); });
// test excluded by task #3693
xit('should delete the ticket, remove the stowaway link and change the stowaway ticket state to "FIXING" and get rid of the itemshelving', async() => { it('should delete ticket, remove stowaway and itemshelving then change stowaway state to "FIXING" ', async() => {
pending('test excluded by task #3693');
const tx = await models.Ticket.beginTransaction({}); const tx = await models.Ticket.beginTransaction({});
try { try {

View File

@ -1,7 +1,6 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
// #2687 - Cannot make a data rollback because of the triggers describe('Travel cloneWithEntries()', () => {
xdescribe('Travel cloneWithEntries()', () => {
const models = app.models; const models = app.models;
const travelId = 5; const travelId = 5;
const currentUserId = 1102; const currentUserId = 1102;
@ -9,44 +8,45 @@ xdescribe('Travel cloneWithEntries()', () => {
let travelBefore; let travelBefore;
let newTravelId; let newTravelId;
afterAll(async() => { // afterAll(async() => {
try { // try {
const entries = await models.Entry.find({ // const entries = await models.Entry.find({
where: { // where: {
travelFk: newTravelId // travelFk: newTravelId
} // }
}); // });
const entriesId = entries.map(entry => entry.id); // const entriesId = entries.map(entry => entry.id);
// Destroy all entries buys // // Destroy all entries buys
await models.Buy.destroyAll({ // await models.Buy.destroyAll({
where: { // where: {
entryFk: {inq: entriesId} // entryFk: {inq: entriesId}
} // }
}); // });
// Destroy travel entries // // Destroy travel entries
await models.Entry.destroyAll({ // await models.Entry.destroyAll({
where: { // where: {
travelFk: newTravelId // travelFk: newTravelId
} // }
}); // });
// Destroy new travel // // Destroy new travel
await models.Travel.destroyById(newTravelId); // await models.Travel.destroyById(newTravelId);
// Restore original travel shipped & landed // // Restore original travel shipped & landed
const travel = await models.Travel.findById(travelId); // const travel = await models.Travel.findById(travelId);
await travel.updateAttributes({ // await travel.updateAttributes({
shipped: travelBefore.shipped, // shipped: travelBefore.shipped,
landed: travelBefore.landed // landed: travelBefore.landed
}); // });
} catch (error) { // } catch (error) {
console.error(error); // console.error(error);
} // }
}); // });
it(`should clone the travel and the containing entries`, async() => { it(`should clone the travel and the containing entries`, async() => {
pending('#2687 - Cannot make a data rollback because of the triggers');
const warehouseThree = 3; const warehouseThree = 3;
const agencyModeOne = 1; const agencyModeOne = 1;
const yesterday = new Date(); const yesterday = new Date();

View File

@ -101,8 +101,9 @@
}, },
"scripts": { "scripts": {
"dbtest": "nodemon -q db/tests.js -w db/tests", "dbtest": "nodemon -q db/tests.js -w db/tests",
"backtest": "nodemon -q back/tests.js --config back/nodemonConfig.json", "test:back": "nodemon -q back/tests.js --config back/nodemonConfig.json",
"test": "jest --watch", "test:e2e": "node e2e/helpers/tests.js",
"test:front": "jest --watch",
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back", "back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
"lint": "eslint ./ --cache --ignore-pattern .gitignore", "lint": "eslint ./ --cache --ignore-pattern .gitignore",
"docker": "docker build --progress=plain -t salix-db ./db" "docker": "docker build --progress=plain -t salix-db ./db"