Skip to content

Commit

Permalink
updated unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-goodwin committed Jul 27, 2019
1 parent aee37aa commit 304ed63
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions tests/specs/shell_spec.js
Expand Up @@ -99,7 +99,7 @@ describe('shell controller', function () {
spyOn($location, 'path').and.callThrough();
click();
expect($location.path.calls.count()).toEqual(2);
expect($location.path()).toEqual(encodeURI('/threatmodel/' + testFileName));
expect($location.path()).toEqual('/threatmodel/' + testFileName);
expect($scope.$apply).toHaveBeenCalled();
});

Expand All @@ -116,7 +116,7 @@ describe('shell controller', function () {
}

spyOn($scope, '$apply').and.callThrough();
spyOn($location, 'path').and.returnValue('/threatmodel/' + encodeURI(testFileName));
spyOn($location, 'path').and.returnValue('/threatmodel/' + testFileName);
spyOn($route, 'reload').and.callThrough();
click();
expect($location.path.calls.count()).toEqual(1);
Expand Down
18 changes: 9 additions & 9 deletions tests/specs/threatmodellocator_spec.js
Expand Up @@ -25,8 +25,8 @@ describe('threatmodellocator service:', function () {

it('should return a file name from an encoded one', function () {

var file = 'c:\dir\file name.json';
var encoded = encodeURI(file);
var file = 'c:\\dir\\file name.json';
var encoded = btoa(file);

var params = {
location: encoded
Expand All @@ -38,7 +38,7 @@ describe('threatmodellocator service:', function () {

it('should return a file name', function () {

var file = 'c:\dir\file name.json';
var file = 'c:\\dir\\file name.json';

var params = {
location: file
Expand All @@ -50,16 +50,16 @@ describe('threatmodellocator service:', function () {

it('should return encoded values unchanged', function () {

var file = 'c:\dir\file name.json';
var encoded = encodeURI(file);
var file = 'c:\\dir\\file name.json';
var encoded = btoa(file);

expect(threatmodellocator.getModelPath(encoded)).toEqual(encoded);
});

it('should encoded values that look unencoded', function () {

var file = 'c:\dir\file name.json';
var encoded = encodeURI(file);
var file = 'c:\\dir\\file name.json';
var encoded = btoa(file);

expect(threatmodellocator.getModelPath(file)).toEqual(encoded);
});
Expand All @@ -78,8 +78,8 @@ describe('threatmodellocator service:', function () {

it('should encoded unencoded route params location', function () {

var file = 'c:\dir\file name.json';
var encoded = encodeURI(file);
var file = 'c:\\dir\\file name.json';
var encoded = btoa(file);

var params = {
location: file
Expand Down
4 changes: 2 additions & 2 deletions tests/specs/welcome_spec.js
Expand Up @@ -63,7 +63,7 @@ describe('welcome controller', function () {
$scope.vm.openModel();

expect($location.path.calls.count()).toEqual(2);
expect($location.path()).toEqual(encodeURI('/threatmodel/' + testFileName));
expect($location.path()).toEqual('/threatmodel/' + testFileName);
expect($scope.$apply).toHaveBeenCalled();
});

Expand All @@ -75,7 +75,7 @@ describe('welcome controller', function () {
}

spyOn($scope, '$apply').and.callThrough();
spyOn($location, 'path').and.returnValue(encodeURI('/threatmodel/' + testFileName));
spyOn($location, 'path').and.returnValue('/threatmodel/' + testFileName);
spyOn($route, 'reload').and.callThrough();
$scope.vm.openModel();
expect($location.path.calls.count()).toEqual(1);
Expand Down

0 comments on commit 304ed63

Please sign in to comment.