[Addressability} Unit Test

Completed unit tests to accomodate
for url path check prior to setting
the current . WTD 23.
This commit is contained in:
Shivam Dave 2015-06-26 12:51:25 -07:00
parent 3de4473159
commit 2e716bdbe3
2 changed files with 13 additions and 4 deletions

View File

@ -222,15 +222,20 @@ define(
mockNavigationService.addListener.mostRecentCall.args[0]( mockNavigationService.addListener.mostRecentCall.args[0](
mockNextObject mockNextObject
); );
// Allows the path index to be checked
// prior to setting $route.current
mockLocation.path.andReturn("/browse/");
// Exercise the Angular workaround
mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled();
// location.path to be called with the urlService's // location.path to be called with the urlService's
// urlFor function with the next domainObject and mode // urlFor function with the next domainObject and mode
expect(mockLocation.path).toHaveBeenCalledWith( expect(mockLocation.path).toHaveBeenCalledWith(
mockUrlService.urlForLocation(mockMode, mockNextObject) mockUrlService.urlForLocation(mockMode, mockNextObject)
); );
// Exercise the Angular workaround
mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled();
}); });
}); });

View File

@ -68,6 +68,10 @@ define(
fireWatch("representation.selected.key", "xyz"); fireWatch("representation.selected.key", "xyz");
expect(mockLocation.search).toHaveBeenCalledWith('view', "xyz"); expect(mockLocation.search).toHaveBeenCalledWith('view', "xyz");
// Allows the path index to be checked
// prior to setting $route.current
mockLocation.path.andReturn("/browse/");
// Exercise the Angular workaround // Exercise the Angular workaround
mockScope.$on.mostRecentCall.args[1](); mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled(); expect(mockUnlisten).toHaveBeenCalled();