Open Dosant opened 6 years ago
ngc
NodeJS Version: 8.9.1 Typescript Version: 2.7.2 Angular Version: 6.0.0 @angular-redux/store version: 9.0.0 @angular/cli version: (if applicable): 6.0.0 OS: macOS 10.13.1
MockNgRedux.getSelectorStub(functionSelector) should properly stub any function selector.
If 2 function selectors were created by one factory function selectors, then the 2nd stub will override previous stub.
This is pretty common scenario to use a selector factory, in my case I am using reselect.
As I understand, the bug happens due to this line: https://github.com/angular-redux/store/blob/master/testing/observable-store.mock.ts#L85.
When selectors are produced by one factory function, we can't compare them using function.toString() method.
Here is the reproduction of a problem's root cause: https://jsfiddle.net/34d76j1y/5/
I guess possible solution would be to use a WeakMap as a cache for selector stubs?
This is a...
What toolchain are you using for transpilation/bundling?
ngc
Environment
NodeJS Version: 8.9.1 Typescript Version: 2.7.2 Angular Version: 6.0.0 @angular-redux/store version: 9.0.0 @angular/cli version: (if applicable): 6.0.0 OS: macOS 10.13.1
Expected Behaviour:
MockNgRedux.getSelectorStub(functionSelector) should properly stub any function selector.
Actual Behaviour:
If 2 function selectors were created by one factory function selectors, then the 2nd stub will override previous stub.
Additional Notes:
This is pretty common scenario to use a selector factory, in my case I am using reselect.
As I understand, the bug happens due to this line: https://github.com/angular-redux/store/blob/master/testing/observable-store.mock.ts#L85.
When selectors are produced by one factory function, we can't compare them using function.toString() method.
Here is the reproduction of a problem's root cause: https://jsfiddle.net/34d76j1y/5/
I guess possible solution would be to use a WeakMap as a cache for selector stubs?