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') {
// steps {
// nodejs('node-v14') {
// sh 'gulp launchBackTest --ci'
// }
// }
// }
stage('Backend') {
steps {
nodejs('node-v14') {
sh 'npm run test:back ci'
}
}
}
}
}
stage('Build') {

View File

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

View File

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

View File

@ -12,11 +12,13 @@ describe('Client updatePortfolio', () => {
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();
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);
@ -26,8 +28,9 @@ describe('Client updatePortfolio', () => {
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 tx = await models.Client.beginTransaction({});
@ -40,7 +43,8 @@ describe('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);

View File

@ -1,7 +1,6 @@
const models = require('vn-loopback/server/server').models;
// Include after #3638 export database
xdescribe('AgencyTerm createInvoiceIn()', () => {
describe('AgencyTerm createInvoiceIn()', () => {
const rows = [
{
routeFk: 2,
@ -17,6 +16,7 @@ xdescribe('AgencyTerm createInvoiceIn()', () => {
];
it('should make an invoiceIn', async() => {
pending('Include after #3638 export database');
const tx = await models.AgencyTerm.beginTransaction({});
const options = {transaction: tx};
@ -32,8 +32,12 @@ xdescribe('AgencyTerm createInvoiceIn()', () => {
await models.AgencyTerm.createInvoiceIn(rows, dms, 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(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');
});
// 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({});
try {

View File

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

View File

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