mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-21 22:16:17 +00:00
Migrated some common components and their dependencies to TS
This commit is contained in:
30
test/servers/DeleteServerButton.test.tsx
Normal file
30
test/servers/DeleteServerButton.test.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { Mock } from 'ts-mockery';
|
||||
import deleteServerButtonConstruct from '../../src/servers/DeleteServerButton';
|
||||
import { ServerWithId } from '../../src/servers/data';
|
||||
|
||||
describe('<DeleteServerButton />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
const DeleteServerModal = () => null;
|
||||
|
||||
beforeEach(() => {
|
||||
const DeleteServerButton = deleteServerButtonConstruct(DeleteServerModal);
|
||||
|
||||
wrapper = shallow(<DeleteServerButton server={Mock.all<ServerWithId>()} className="button" />);
|
||||
});
|
||||
afterEach(() => wrapper.unmount());
|
||||
|
||||
it('renders a button and a modal', () => {
|
||||
expect(wrapper.find('.button')).toHaveLength(1);
|
||||
expect(wrapper.find(DeleteServerModal)).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('displays modal when button is clicked', () => {
|
||||
const btn = wrapper.find('.button');
|
||||
|
||||
expect(wrapper.find(DeleteServerModal).prop('isOpen')).toEqual(false);
|
||||
btn.simulate('click');
|
||||
expect(wrapper.find(DeleteServerModal).prop('isOpen')).toEqual(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user