Skip to content

Commit

Permalink
test: fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Aug 5, 2020
1 parent b44fac9 commit db7629b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion packages/vx-shape/test/BarGroup.test.tsx
Expand Up @@ -29,7 +29,7 @@ const data: Datum[] = [
];

const x0 = () => 5;
const x0Scale = scaleBand({ domain: [0, 100], range: [0, 100] });
const x0Scale = scaleBand({ domain: [5, 15], range: [0, 100] });
const x1Scale = scaleBand({ domain: [0, 100], range: [0, 100] });
const yScale = scaleLinear({ domain: [0, 100], range: [0, 100] });

Expand Down
14 changes: 3 additions & 11 deletions packages/vx-shape/test/Pie.test.tsx
Expand Up @@ -50,11 +50,6 @@ const PieChildren = ({ children, ...restProps }: Partial<PieProps<Datum>>) =>
);

describe('<Pie />', () => {
beforeEach(() => {
// eslint-disable-next-line @typescript-eslint/unbound-method
global.console.error = jest.fn();
});

test('it should be defined', () => {
expect(Pie).toBeDefined();
});
Expand Down Expand Up @@ -91,9 +86,6 @@ describe('<Pie />', () => {
test('it should break on invalid sort callbacks', () => {
expect(() => PieWrapper({ pieSort: 12 })).toThrow();
expect(() => PieWrapper({ pieSortValues: 12 })).toThrow();
// eslint-disable-next-line @typescript-eslint/unbound-method
expect(console.error).toBeCalled();
expect((console.error as jest.Mock).mock.calls).toHaveLength(2);
});

test('it should have the .vx-pie-arcs-group class', () => {
Expand All @@ -115,8 +107,8 @@ describe('<Pie />', () => {
PieChildren({ children: fn });
const args = fn.mock.calls[0][0];
const keys = Object.keys(args);
expect(keys.includes('path')).toEqual(true);
expect(keys.includes('arcs')).toEqual(true);
expect(keys.includes('pie')).toEqual(true);
expect(keys).toContain('path');
expect(keys).toContain('arcs');
expect(keys).toContain('pie');
});
});

0 comments on commit db7629b

Please sign in to comment.