Skip to content

Commit 8eee242

Browse files
refactor(pushTo): add curry
test(hookBuilder): use TestingPlugin
1 parent 0dfd227 commit 8eee242

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/common/common.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ export const removeFrom = curry((array: any[], obj: any) => {
137137
});
138138

139139
/** pushes a values to an array and returns the value */
140-
export const pushTo = <T> (arr: T[], val: T) =>
141-
(arr.push(val), val);
140+
export const pushTo = curry((arr: any[], val: any) =>
141+
(arr.push(val), val));
142142

143143
/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */
144144
export const deregAll = (functions: Function[]) =>

test/hookBuilderSpec.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { UIRouter, TransitionService, StateService, State, PathNode } from "../src/index";
22
import { tree2Array } from "./_testUtils";
33
import { TransitionHookPhase } from "../src/transition/interface";
4-
import * as vanilla from "../src/vanilla/index";
4+
import { TestingPlugin } from "./_testingPlugin";
55

66
describe('HookBuilder:', function() {
77
let uiRouter: UIRouter = null;
@@ -16,8 +16,7 @@ describe('HookBuilder:', function() {
1616
beforeEach(() => {
1717
log = "";
1818
uiRouter = new UIRouter();
19-
uiRouter.plugin(vanilla.servicesPlugin);
20-
uiRouter.plugin(vanilla.hashLocationPlugin);
19+
uiRouter.plugin(TestingPlugin);
2120

2221
$trans = uiRouter.transitionService;
2322
$state = uiRouter.stateService;
@@ -36,7 +35,6 @@ describe('HookBuilder:', function() {
3635
};
3736

3837
tree2Array(statetree, true).forEach(state => uiRouter.stateRegistry.register(state));
39-
uiRouter.stateRegistry.stateQueue.autoFlush($state);
4038
});
4139

4240
let trans, trans2, hb, hb2, callback;

0 commit comments

Comments
 (0)