【发布时间】:2018-05-16 18:07:51
【问题描述】:
我正在尝试使用 Jest 为我的 MobX 商店进行测试。
我正在使用 Mobx、React 和 Jest。
class ConfigStore {
constructor(RootStore) {
this.rootStore = RootStore;
this.config = {};
}
}
class DataStore {
constructor(RootStore) {
this.config = RootStore.config;
}
}
class UIStore {
constructor(RootStore) {
this.config = RootStore.config;
this.data = RootStore.data;
}
}
class RootStore {
constructor() {
this.config = new ConfigStore(this);
this.ui = new UIStore(this);
this.data = new DataStore(this);
}
}
我的商店设置是否正确?
如果是这样,在将商店传递给 Provider 之前对其进行测试的最佳方法是什么?
【问题讨论】:
标签: javascript reactjs unit-testing jestjs mobx