I have a fairly simple viewComments component and I wrote unit test for that component
const viewHistory = () => {
return (
render(
<Router history={history}>
<Provider {...rootStore()}>
<ViewComments {...data}/>
</Provider>
</Router>
))
}
There is a pluginStore file which will initialize required object (rootStore) and send
import { COMMON } from '../common/constants/stores';
import { CommonStore } from './common/commonStore';
import { CommonState } from '../models/commonState';
export function pluginStores(
commonState: CommonState,
) {
const commonStore = new CommonStore(commonState);
return {
[COMMON]: commonStore,
};
}
export function rootStore() {
const commonStore = new CommonStore(new CommonState);
return {
[COMMON]: commonStore,
};
}
export class RootStore {
commonState: CommonState;
commonStore: CommonStore;
constructor() {
this.commonState = new CommonState();
this.commonStore = new CommonStore(this.commonState);
}
}
but upon running the test i am getting typeError
enter image description here
New contributor
Kuldeep Kumar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.