Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("should trigger the focus on mount", () => {
const onFocusCallback = sinon.spy();
mount(, mountOptions);
// Read the focus
expect(onFocusCallback.callCount).to.equal(1);
});
it(`persists new opened window`, () => {
const openCallback = sinon.stub(window,'open').returns('newPage');
const wrapper = mount( );
const actualNewWindow= wrapper.instance().getWindow();
expect(actualNewWindow).toEqual('newPage');
openCallback.restore();
});
});
test('Swipe component', (t) => {
const wrapper = mount(
<li>1</li><li>2</li>
)
t.pass(
expect(wrapper.props().elementId).toEqual('react-swipe-1')
)
t.pass(
expect(wrapper.props().children[0]).toEqual(<li>1</li>)
)
t.end()
});
test(' - renders correct label (specified)', () => {
const element = ;
const wrapper = mount(
element,
createContext({ x: { type: Array }, 'x.$': { type: String } }),
);
expect(wrapper.find(ListSubheader)).toHaveLength(1);
expect(wrapper.find(ListSubheader).text()).toBe('ListFieldLabel');
});
it('should not remove the notification when dismissible is false',() => {
notification.dismissible = false;
const wrapper = mount(
);
wrapper.find(ConnectedNotification).simulate('click');
expect(store.getActions()).toEqual([]);
});
it('should render proper notification message', () => {
const wrapper = mount()
expect(wrapper.find('.pf-m-notice').exists()).toEqual(true)
expect(wrapper.find('.pf-m-notice').text()).toContain('You are advised!')
})
function setup() {
const props = {
token: {},
match: {
params: {
tokenId: "4"
}
}
}
const enzymeWrapper = mount(
)
return {
props,
enzymeWrapper
}
}
beforeEach(() => {
mockStore = createStore(navBar);
mockDispatch = jest.spyOn(mockStore, 'dispatch');
wrapper = mount(
);
node = wrapper.find(PostMigrationDialog);
instance = wrapper.find(PostMigrationDialog).instance();
});
errorMessage: {}
},
signUp: {
isFetchingSuccessful: false,
isFetching: false,
errorMessage: {}
},
signUpActions: {}
};
const middlewares = [ thunk ];
const mockStore = configureMockStore(middlewares);
const store = mockStore(initialState);
const wrapper = mount(
);
return {
wrapper,
store
};
};