From 2e716bdbe327d55be09ded8117dd083c2b14c9b8 Mon Sep 17 00:00:00 2001 From: Shivam Dave Date: Fri, 26 Jun 2015 12:51:25 -0700 Subject: [PATCH] [Addressability} Unit Test Completed unit tests to accomodate for url path check prior to setting the current . WTD 23. --- .../commonUI/browse/test/BrowseControllerSpec.js | 13 +++++++++---- .../browse/test/BrowseObjectControllerSpec.js | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/platform/commonUI/browse/test/BrowseControllerSpec.js b/platform/commonUI/browse/test/BrowseControllerSpec.js index ca9a926f0d..ce9296c239 100644 --- a/platform/commonUI/browse/test/BrowseControllerSpec.js +++ b/platform/commonUI/browse/test/BrowseControllerSpec.js @@ -222,15 +222,20 @@ define( mockNavigationService.addListener.mostRecentCall.args[0]( 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 // urlFor function with the next domainObject and mode expect(mockLocation.path).toHaveBeenCalledWith( mockUrlService.urlForLocation(mockMode, mockNextObject) ); - - // Exercise the Angular workaround - mockScope.$on.mostRecentCall.args[1](); - expect(mockUnlisten).toHaveBeenCalled(); }); }); diff --git a/platform/commonUI/browse/test/BrowseObjectControllerSpec.js b/platform/commonUI/browse/test/BrowseObjectControllerSpec.js index e498c1dc12..9fc7ba3119 100644 --- a/platform/commonUI/browse/test/BrowseObjectControllerSpec.js +++ b/platform/commonUI/browse/test/BrowseObjectControllerSpec.js @@ -68,6 +68,10 @@ define( fireWatch("representation.selected.key", "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 mockScope.$on.mostRecentCall.args[1](); expect(mockUnlisten).toHaveBeenCalled();