2020-04-20 11:49:33 +00:00
|
|
|
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');
|
2023-09-20 06:12:07 +00:00
|
|
|
let geoFk = 16;
|
2020-04-20 11:49:33 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|