Merge pull request '2204-dbtest_zone_getEvents' (#280) from 2204-dbtest_zone_getEvents into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2020-05-26 10:16:05 +00:00
commit 731e411cf8
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
const app = require('vn-loopback/server/server');
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
describe('zone zone_getEvents()', () => {
it(`should return data for a agencyMode with deliveryMethod pickup`, async() => {
let stmts = [];
let stmt;
stmts.push('START TRANSACTION');
let params = {
zoneGeoFk: 1,
agencyModeFk: 1};
stmt = new ParameterizedSQL('CALL zone_getEvents(?, ?)', [
params.zoneGeoFk,
params.agencyModeFk,
]);
stmts.push(stmt);
let firstResultIndex = stmts.push(stmt) - 1;
let secondResultIndex = firstResultIndex + 1;
stmts.push('ROLLBACK');
let sql = ParameterizedSQL.join(stmts, ';');
let result = await app.models.Ticket.rawStmt(sql);
let zonesEvents = result[secondResultIndex];
expect(zonesEvents.length).toBeGreaterThan(0);
});
});