dbtest zone_getEvent

This commit is contained in:
Bernat Exposito Domenech 2020-05-26 12:07:52 +02:00
parent 26930c5091
commit 41bf237289
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);
});
});