homehub/packages/homehub_app/tests/main/components/AboutModal.spec.js

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-08-26 10:33:15 +00:00
import {shallow} from 'enzyme';
import React from 'react';
import {Button, Modal} from 'src/components';
import * as AboutModal from 'src/main/components/AboutModal';
describe('src/main/components/AboutModal', () => {
describe('AboutModal', () => {
it('configures and renders the about modal', () => {
// Given
const mockOnClose = jasmine.createSpy();
const component = shallow(
<AboutModal.AboutModal
build={123}
show={true}
version='1.0'
onClose={mockOnClose}
/>
);
// Then
const modal = component.find(Modal);
expect(modal.exists()).toBe(true);
expect(modal.prop('show')).toBe(true);
expect(modal.prop('onClose')).toEqual(mockOnClose);
const versionLine = component.find('p.text-muted');
expect(versionLine.text()).toMatch('v1.0-123');
const button = component.find(Button).at(0);
expect(button.exists()).toBe(true);
expect(button.prop('onClick')).toEqual(mockOnClose);
});
});
});