forked from antonioru/beautiful-react-diagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Segment.spec.js
28 lines (21 loc) · 958 Bytes
/
Segment.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React from 'react';
import { render, cleanup } from '@testing-library/react';
import Segment from '../dist/Diagram/Segment/Segment';
describe('Segment component', () => {
afterEach(cleanup);
it('should render without explode', () => {
const { container } = render(<Segment from={[10, 10]} to={[20, 20]} />);
should.exist(container);
expect(container.querySelector('g')).to.exist;
});
it('should have default classes', () => {
const { container } = render(<Segment from={[10, 10]} to={[20, 20]} />);
const wrapper = container.querySelector('g');
expect(wrapper.getAttribute('class').split(' ')).to.include.members(['bi-diagram-segment']);
});
it('should possibly have an alignment', () => {
const { container } = render(<Segment from={[10, 10]} to={[20, 20]} alignment="right" />);
const path = container.querySelector('g path').getAttribute('d');
expect(path.includes('C')).to.be.true;
});
});