I'm trying to build some tests around a controller. I am injecting a test with $stateParams, and navigating to the same state twice. The first test passes, but the second test fails because it thinks the creationId is still 1.
it('should navigate to customizer with a creation ID', function (done) {
inject(function ($state, $stateParams, $rootScope) {
$state.go('customizer', {creationId: 1});
$rootScope.$digest();
expect($stateParams).to.have.property('creationId','1');
done();
});
});
it('should navigate to customizer without a creation ID', function (done) {
inject(function ($state, $stateParams, $rootScope) {
$state.go('customizer');
$rootScope.$digest();
expect($stateParams).to.not.have.property('creationId','1');
done();
});
});
Why is this happening? Is there something I need to run on beforeEach or afterEach to clear the state?
Aucun commentaire:
Enregistrer un commentaire