diff --git a/db/tests/vn/zone_getEvents.spec.js b/db/tests/vn/zone_getEvents.spec.js new file mode 100644 index 000000000..d31e97c2c --- /dev/null +++ b/db/tests/vn/zone_getEvents.spec.js @@ -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); + }); +});