diff --git a/mon-pix/tests/unit/routes/login-pe_test.js b/mon-pix/tests/unit/routes/login-pe_test.js index 60870e0c66e..76b5914bd2f 100644 --- a/mon-pix/tests/unit/routes/login-pe_test.js +++ b/mon-pix/tests/unit/routes/login-pe_test.js @@ -1,3 +1,4 @@ +import { expect } from 'chai'; import { describe, it } from 'mocha'; import sinon from 'sinon'; import { setupTest } from 'ember-mocha'; @@ -6,10 +7,12 @@ describe('Unit | Route | login-pe', function () { setupTest(); let route; + const loginTransition = Symbol('login transition'); beforeEach(function () { route = this.owner.lookup('route:login-pe'); sinon.stub(route, 'replaceWith'); + route.replaceWith.withArgs('login').returns(loginTransition); }); context('when pole-emploi user disallow PIX to use data', function () { @@ -17,7 +20,7 @@ describe('Unit | Route | login-pe', function () { error: 'access_denied', }; - it('should redirect to login route if there is an error in transition.to', async function () { + it('should redirect to login route if there is an error in transition.to', function () { // given const transition = { to: { @@ -26,23 +29,23 @@ describe('Unit | Route | login-pe', function () { }; // when - await route.beforeModel(transition); + const transitionResult = route.beforeModel(transition); // then - sinon.assert.calledWith(route.replaceWith, 'login'); + expect(transitionResult).to.equal(loginTransition); }); - it('should redirect to login route if there is an error in transition', async function () { + it('should redirect to login route if there is an error in transition', function () { // given const transition = { queryParams, }; // when - await route.beforeModel(transition); + const transitionResult = route.beforeModel(transition); // then - sinon.assert.calledWith(route.replaceWith, 'login'); + expect(transitionResult).to.equal(loginTransition); }); }); });