#678 planificacion de tests db + small refactor on new.js

This commit is contained in:
Carlos Jimenez 2018-09-26 15:48:33 +02:00
parent 0c9678ada8
commit 79fc3bd7dc
3 changed files with 45 additions and 2 deletions

42
db_tests.js Normal file
View File

@ -0,0 +1,42 @@
process.on('warning', warning => {
console.log(warning.name);
console.log(warning.message);
console.log(warning.stack);
});
var verbose = false;
if (process.argv[2] === '--v') {
verbose = true;
}
servicesDir = `${__dirname}/services/db`;
var Jasmine = require('jasmine');
var jasmine = new Jasmine();
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
let environment = require('gulp-env');
environment(".env.json");
let serviceSpecs = [
'db/tests/**/*[sS]pec.js'
];
jasmine.loadConfig({
spec_dir: 'services',
spec_files: serviceSpecs,
helpers: [
'/services/utils/jasmineHelpers.js'
]
});
jasmine.addReporter(new SpecReporter({
spec: {
// displayStacktrace: 'summary',
displaySuccessful: verbose,
displayFailedSpec: true,
displaySpecDuration: true
}
}));
jasmine.execute();

View File

@ -81,6 +81,7 @@
},
"scripts": {
"test": "nodemon -q services_tests.js -w services",
"dbtest": "nodemon -q db_tests.js -w services/db/tests",
"lint": "eslint ./ --cache --ignore-pattern .gitignore"
}
}

View File

@ -26,8 +26,8 @@ module.exports = Self => {
if (!existsAddress)
throw new UserError(`This address doesn't exist`);
let query = `CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @pe);
SELECT @pe newTicketId;`;
let query = `CALL vn.ticketCreateWithUser(?, ?, ?, ?, ?, ?, ?, ?, ?, @result);
SELECT @result newTicketId;`;
let result = await Self.rawSql(query, [
params.clientFk,
params.shipped,