当我在beforeEach(()=> {...
中声明initialState为const时,出现了以下错误:
ReferenceError: initialState未定义
这不应该起作用吗?
请注意,本文中的HTML标签已被保留。
describe('register reducer', () => {
beforeEach(() => {
const initialState = UsersService.getInitialUsersState();
})
it('should return the initial state', () => {
expect(usersReducer(undefined, [])).toEqual(initialState);
});
it('Toggle isBaby or sitter', () => {
deepFreeze(initialState);
let newState = initialState;
newState.isBaby = true;
expect(
usersReducer(initialState, {
type: types.UsersActions.SET_TYPE,
payload: true
})).toEqual(newState);
});
var
,但它没有起作用。 - July333