salix/db/tests/vn/zone_getFromGeo.spec.js

29 lines
849 B
JavaScript

const app = require('vn-loopback/server/server');
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
describe('zone zone_getFromGeo()', () => {
it(`should check that there are some results in table zone`, async() => {
let stmts = [];
let stmt;
stmts.push('START TRANSACTION');
let geoFk = 16;
stmt = new ParameterizedSQL('CALL zone_getFromGeo(?)', [
geoFk,
]);
stmts.push(stmt);
let tableIndex = stmts.push('SELECT count(*) countZone FROM tmp.zone WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8)') - 1;
stmts.push('ROLLBACK');
let sql = ParameterizedSQL.join(stmts, ';');
let result = await app.models.Ticket.rawStmt(sql);
let [zoneTable] = result[tableIndex];
expect(zoneTable.countZone).toBe(8);
});
});