diff --git a/packages/visx-xychart/test/components/Annotation.test.tsx b/packages/visx-xychart/test/components/Annotation.test.tsx new file mode 100644 index 000000000..ac21ab1bd --- /dev/null +++ b/packages/visx-xychart/test/components/Annotation.test.tsx @@ -0,0 +1,62 @@ +import React from 'react'; +import { mount } from 'enzyme'; +import { + Annotation as VxAnnotation, + EditableAnnotation as VxEditableAnnotation, +} from '@visx/annotation'; +import { DataContext, Annotation, AnimatedAnnotation } from '../../src'; +import getDataContext from '../mocks/getDataContext'; + +const series = { key: 'visx', data: [{}], xAccessor: () => 4, yAccessor: () => 7 }; + +function setup(children: React.ReactNode) { + return mount( + + {children} + , + ); +} + +describe('', () => { + it('should be defined', () => { + expect(Annotation).toBeDefined(); + }); + it('should render a VxAnnotation', () => { + const wrapper = setup( + + {'test'} + , + ); + expect(wrapper.find(VxAnnotation)).toHaveLength(1); + }); + it('should render a VxEditableAnnotation when editable=true', () => { + const wrapper = setup( + + {'test'} + , + ); + expect(wrapper.find(VxEditableAnnotation)).toHaveLength(1); + }); +}); + +describe('', () => { + it('should be defined', () => { + expect(AnimatedAnnotation).toBeDefined(); + }); + it('should render a VxAnnotation', () => { + const wrapper = setup( + + {'test'} + , + ); + expect(wrapper.find(VxAnnotation)).toHaveLength(1); + }); + it('should render a VxEditableAnnotation when editable=true', () => { + const wrapper = setup( + + {'test'} + , + ); + expect(wrapper.find(VxEditableAnnotation)).toHaveLength(1); + }); +}); diff --git a/packages/visx-xychart/test/components/AnnotationCircleSubject.test.tsx b/packages/visx-xychart/test/components/AnnotationCircleSubject.test.tsx new file mode 100644 index 000000000..ad2744f58 --- /dev/null +++ b/packages/visx-xychart/test/components/AnnotationCircleSubject.test.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { CircleSubject as VxAnnotationCircleSubject } from '@visx/annotation'; +import { AnnotationCircleSubject } from '../../src'; + +describe('', () => { + it('should be defined', () => { + expect(AnnotationCircleSubject).toBeDefined(); + }); + it('should render a VxAnnotationCircleSubject', () => { + const wrapper = shallow(); + expect(wrapper.find(VxAnnotationCircleSubject)).toHaveLength(1); + }); +}); diff --git a/packages/visx-xychart/test/components/AnnotationConnector.test.tsx b/packages/visx-xychart/test/components/AnnotationConnector.test.tsx new file mode 100644 index 000000000..7b8fb83eb --- /dev/null +++ b/packages/visx-xychart/test/components/AnnotationConnector.test.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { Connector as VxAnnotationConnector } from '@visx/annotation'; +import { AnnotationConnector } from '../../src'; + +describe('', () => { + it('should be defined', () => { + expect(AnnotationConnector).toBeDefined(); + }); + it('should render a VxAnnotationConnector', () => { + const wrapper = shallow(); + expect(wrapper.find(VxAnnotationConnector)).toHaveLength(1); + }); +}); diff --git a/packages/visx-xychart/test/components/AnnotationLabel.test.tsx b/packages/visx-xychart/test/components/AnnotationLabel.test.tsx new file mode 100644 index 000000000..c2735c383 --- /dev/null +++ b/packages/visx-xychart/test/components/AnnotationLabel.test.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { Label as VxAnnotationLabel } from '@visx/annotation'; +import { AnnotationLabel } from '../../src'; + +describe('', () => { + it('should be defined', () => { + expect(AnnotationLabel).toBeDefined(); + }); + it('should render a VxAnnotationLabel', () => { + const wrapper = shallow(); + expect(wrapper.find(VxAnnotationLabel)).toHaveLength(1); + }); +}); diff --git a/packages/visx-xychart/test/components/AnnotationLineSubject.test.tsx b/packages/visx-xychart/test/components/AnnotationLineSubject.test.tsx new file mode 100644 index 000000000..71f1451fb --- /dev/null +++ b/packages/visx-xychart/test/components/AnnotationLineSubject.test.tsx @@ -0,0 +1,14 @@ +import React from 'react'; +import { shallow } from 'enzyme'; +import { LineSubject as VxAnnotationLineSubject } from '@visx/annotation'; +import { AnnotationLineSubject } from '../../src'; + +describe('', () => { + it('should be defined', () => { + expect(AnnotationLineSubject).toBeDefined(); + }); + it('should render a VxAnnotationLineSubject', () => { + const wrapper = shallow(); + expect(wrapper.find(VxAnnotationLineSubject)).toHaveLength(1); + }); +}); diff --git a/packages/visx-xychart/test/components/Axis.test.tsx b/packages/visx-xychart/test/components/Axis.test.tsx index 02a95c1a8..74455511c 100644 --- a/packages/visx-xychart/test/components/Axis.test.tsx +++ b/packages/visx-xychart/test/components/Axis.test.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React from 'react'; import { shallow, mount } from 'enzyme'; import VxAnimatedAxis from '@visx/react-spring/lib/axis/AnimatedAxis'; import VxAxis from '@visx/axis/lib/axis/Axis'; diff --git a/packages/visx-xychart/test/mocks/getDataContext.ts b/packages/visx-xychart/test/mocks/getDataContext.ts index 1bca4a070..b7076a039 100644 --- a/packages/visx-xychart/test/mocks/getDataContext.ts +++ b/packages/visx-xychart/test/mocks/getDataContext.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { scaleLinear, scaleOrdinal } from '@visx/scale'; -import { DataContextType, lightTheme } from '../../lib'; +import { DataContextType, lightTheme } from '../../src'; import DataRegistry from '../../lib/classes/DataRegistry'; const width = 10;