我最近升級我的角度的應用程序,其中涉及升級的角度包:單元測試終極版供電角應用
- 所有@角/ *包從
4.0.0
=>4.4.5
- 的@ angular-終極版/商店包從
6.1.0
=>6.5.7
在角4.0.0
與NgRedux 6.1.0
,這用來工作:
store = new NgRedux<IAppState>(null);
store.configureStore(reducerConfig, undefined);
// etc.
但顯然,他們做了NgRedux
類abstract
。因此,我的單元測試會失敗,以下異常:Cannot create an instance of the abstract class 'NgRedux'.
我試圖通過使用自定義嘲笑類來解決我的測試,提出了Testing Redux - Testing Simple Actions:
class MockRedux extends NgRedux<any> {
constructor() {
super(null);
}
dispatch =() => undefined;
}
但是這並沒有因不執行所有的抽象成員像這樣的錯誤:
[ts] Non-abstract class 'MockRedux' does not implement inherited abstract member 'configureSubStore' from class 'NgRedux<any>'.
於是問題出現了:我怎麼正確地嘲笑我的角度規範內的NgRedux一個終極版商店嗎?
看看在[**中博客**](https://medium.com/@aravindfz/unit-testing-of-ngrx-store-in-angular-app-d0935c8d8d1b) – Aravind