Merge pull request 'fix: refs #8515 Fix test optimizePriority' (!3414) from 8515-fixTestOptimizePriority into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #3414 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
3bb0d52dde
|
@ -1,7 +1,16 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const routeId = 1;
|
||||
|
||||
describe('route optimizePriority())', function() {
|
||||
describe('route optimizePriority()', function() {
|
||||
beforeEach(() => {
|
||||
spyOn(models.OsrmConfig, 'optimize').and.returnValue(
|
||||
Promise.resolve([
|
||||
{addressId: 1, position: 0},
|
||||
{addressId: 2, position: 1}
|
||||
])
|
||||
);
|
||||
});
|
||||
|
||||
it('should execute without throwing errors', async function() {
|
||||
const tx = await models.Route.beginTransaction({});
|
||||
let error;
|
||||
|
@ -20,9 +29,10 @@ describe('route optimizePriority())', function() {
|
|||
}
|
||||
|
||||
expect(error).toBeUndefined();
|
||||
expect(models.OsrmConfig.optimize).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should execute with error', async function() {
|
||||
it('should execute with error when all tickets have a route order', async function() {
|
||||
let error;
|
||||
try {
|
||||
await models.Route.optimizePriority(routeId);
|
||||
|
|
Loading…
Reference in New Issue