bigbuffet-rw/app/soapbox/features/ui/components/__tests__/compose-button.test.js

27 lines
866 B
JavaScript
Raw Normal View History

2022-03-21 11:09:01 -07:00
import { Map as ImmutableMap } from 'immutable';
import React from 'react';
import { MODAL_OPEN } from 'soapbox/actions/modals';
import rootReducer from 'soapbox/reducers';
import { createComponent, mockStore } from 'soapbox/test_helpers';
import ComposeButton from '../compose-button';
describe('<ComposeButton />', () => {
it('renders a button element', () => {
const component = createComponent(<ComposeButton />);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
it('dispatches the MODAL_OPEN action', () => {
const store = mockStore(rootReducer(ImmutableMap(), {}));
const component = createComponent(<ComposeButton />, { store });
expect(store.getActions().length).toEqual(0);
component.root.findByType('button').props.onClick();
expect(store.getActions()[0].type).toEqual(MODAL_OPEN);
});
});