我的根组件使用AppState并尝试用玩笑来拍摄快照。
运行命令时,我得到以下信息:
$ jest
FAIL ./App.test.js (10.276s)
<App />
× renders correctly (169ms)
● <App /> › renders correctly
**TypeError: Cannot read property 'match' of undefined**
60 |
61 | getMissingPermissions = () => {
> 62 | if (this.state.appState.match(/active/)) {
| ^
63 | Promise.all(
64 | Object.keys(permissions).map((key) => {
65 | return permissions[key].checkPermission().then(({ status }) => {
我该如何解决?