Skip to content

Commit e659227

Browse files
chore(test): move beforeEach block into a describe block so it's not executed globally
1 parent f07b369 commit e659227

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

test/urlMatcherFactorySpec.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ var router: UIRouter;
77
var $umf: UrlMatcherFactory;
88
var $location: LocationServices;
99

10-
beforeEach(function() {
10+
function init() {
1111
router = new UIRouter();
1212
router.plugin(TestingPlugin);
1313
$umf = router.urlMatcherFactory;
1414
let locationPlugin = router.getPlugin('vanilla.memoryLocation') as LocationPlugin;
1515
$location = locationPlugin.service;
16-
});
16+
}
1717

1818
describe("UrlMatcher", function () {
19+
beforeEach(init);
1920

2021
describe("provider", function () {
2122

@@ -510,6 +511,8 @@ describe("UrlMatcher", function () {
510511
});
511512

512513
describe("urlMatcherFactoryProvider", function () {
514+
beforeEach(init);
515+
513516
describe(".type()", function () {
514517
var m;
515518
beforeEach(function() {
@@ -535,6 +538,7 @@ describe("urlMatcherFactoryProvider", function () {
535538
});
536539

537540
describe("urlMatcherFactory", function () {
541+
beforeEach(init);
538542

539543
it("compiles patterns", function () {
540544
var matcher = $umf.compile('/hello/world');

test/urlRouterSpec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,21 @@ describe("UrlRouter", function () {
120120

121121
describe("location updates", function() {
122122
it('can push location changes', function () {
123-
spyOn(router.locationService, "url");
123+
spyOn(router.urlService, "url");
124124
urlRouter.push(matcher("/hello/:name"), { name: "world" });
125-
expect(router.locationService.url).toHaveBeenCalledWith("/hello/world", undefined);
125+
expect(router.urlService.url).toHaveBeenCalledWith("/hello/world", undefined);
126126
});
127127

128128
it('can push a replacement location', function () {
129-
spyOn(router.locationService, "url");
129+
spyOn(router.urlService, "url");
130130
urlRouter.push(matcher("/hello/:name"), { name: "world" }, { replace: true });
131-
expect(router.locationService.url).toHaveBeenCalledWith("/hello/world", true);
131+
expect(router.urlService.url).toHaveBeenCalledWith("/hello/world", true);
132132
});
133133

134134
it('can push location changes with no parameters', function () {
135-
spyOn(router.locationService, "url");
135+
spyOn(router.urlService, "url");
136136
urlRouter.push(urlMatcherFactory.compile("/hello/:name", { params: { name: "" } }));
137-
expect(router.locationService.url).toHaveBeenCalledWith("/hello/", undefined);
137+
expect(router.urlService.url).toHaveBeenCalledWith("/hello/", undefined);
138138
});
139139

140140
it('can push location changes that include a #fragment', function () {

0 commit comments

Comments
 (0)