diff --git a/test/urlMatcherFactorySpec.ts b/test/urlMatcherFactorySpec.ts index 74e3cd6d..9b183a44 100644 --- a/test/urlMatcherFactorySpec.ts +++ b/test/urlMatcherFactorySpec.ts @@ -7,15 +7,16 @@ var router: UIRouter; var $umf: UrlMatcherFactory; var $location: LocationServices; -beforeEach(function() { +function init() { router = new UIRouter(); router.plugin(TestingPlugin); $umf = router.urlMatcherFactory; let locationPlugin = router.getPlugin('vanilla.memoryLocation') as LocationPlugin; $location = locationPlugin.service; -}); +} describe("UrlMatcher", function () { + beforeEach(init); describe("provider", function () { @@ -510,6 +511,8 @@ describe("UrlMatcher", function () { }); describe("urlMatcherFactoryProvider", function () { + beforeEach(init); + describe(".type()", function () { var m; beforeEach(function() { @@ -535,6 +538,7 @@ describe("urlMatcherFactoryProvider", function () { }); describe("urlMatcherFactory", function () { + beforeEach(init); it("compiles patterns", function () { var matcher = $umf.compile('/hello/world'); diff --git a/test/urlRouterSpec.ts b/test/urlRouterSpec.ts index 51a3a67d..2d1a709e 100644 --- a/test/urlRouterSpec.ts +++ b/test/urlRouterSpec.ts @@ -120,21 +120,21 @@ describe("UrlRouter", function () { describe("location updates", function() { it('can push location changes', function () { - spyOn(router.locationService, "url"); + spyOn(router.urlService, "url"); urlRouter.push(matcher("/hello/:name"), { name: "world" }); - expect(router.locationService.url).toHaveBeenCalledWith("/hello/world", undefined); + expect(router.urlService.url).toHaveBeenCalledWith("/hello/world", undefined); }); it('can push a replacement location', function () { - spyOn(router.locationService, "url"); + spyOn(router.urlService, "url"); urlRouter.push(matcher("/hello/:name"), { name: "world" }, { replace: true }); - expect(router.locationService.url).toHaveBeenCalledWith("/hello/world", true); + expect(router.urlService.url).toHaveBeenCalledWith("/hello/world", true); }); it('can push location changes with no parameters', function () { - spyOn(router.locationService, "url"); + spyOn(router.urlService, "url"); urlRouter.push(urlMatcherFactory.compile("/hello/:name", { params: { name: "" } })); - expect(router.locationService.url).toHaveBeenCalledWith("/hello/", undefined); + expect(router.urlService.url).toHaveBeenCalledWith("/hello/", undefined); }); it('can push location changes that include a #fragment', function () {