Skip to content

Commit

Permalink
add unit test for testing hiding multiple series by default
Browse files Browse the repository at this point in the history
  • Loading branch information
clcatalan committed Jul 8, 2024
1 parent fa5b2f4 commit 18d55e2
Showing 1 changed file with 59 additions and 1 deletion.
60 changes: 59 additions & 1 deletion packages/line/tests/Line.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ it('should create slice for each x value', () => {
expect(slices.at(4).prop('slice').x).toBe(500)
})

it('should hide certain line charts by default given their ids', () => {
it('should hide single line charts by default given their id', () => {
const data = [
{
id: 'A',
Expand All @@ -112,6 +112,16 @@ it('should hide certain line charts by default given their ids', () => {
{ x: 5, y: 9 },
],
},
{
id: 'C',
data: [
{ x: 0, y: 5 },
{ x: 2, y: 9 },
{ x: 3, y: 13 },
{ x: 4, y: 11 },
{ x: 5, y: 10 },
],
},
]
const wrapper = mount(
<Line

Check failure on line 127 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Delete `·`
Expand All @@ -128,6 +138,54 @@ it('should hide certain line charts by default given their ids', () => {
expect(lines).toHaveLength(1)
})

it('should hide multiple line charts by default given their ids', () => {
const data = [
{
id: 'A',
data: [
{ x: 0, y: 3 },
{ x: 1, y: 7 },
{ x: 2, y: 11 },
{ x: 3, y: 9 },
{ x: 4, y: 8 },
],
},
{
id: 'B',
data: [
{ x: 0, y: 4 },
{ x: 2, y: 8 },
{ x: 3, y: 12 },
{ x: 4, y: 10 },
{ x: 5, y: 9 },
],
},
{
id: 'C',
data: [
{ x: 0, y: 5 },
{ x: 2, y: 9 },
{ x: 3, y: 13 },
{ x: 4, y: 11 },
{ x: 5, y: 10 },
],
},
]
const wrapper = mount(
<Line

Check failure on line 175 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Delete `·`
width={500}

Check failure on line 176 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Delete `·`
height={300}

Check failure on line 177 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Delete `·`
data={data}

Check failure on line 178 in packages/line/tests/Line.test.js

View workflow job for this annotation

GitHub Actions / build

Delete `··`
enableSlices="x"
animate={false}
initialHiddenIds={['B', 'C']}
/>
)

const lines = wrapper.find(Lines)
expect(lines).toHaveLength(1)
})

it('should have left and bottom axis by default', () => {
const data = [
{
Expand Down

0 comments on commit 18d55e2

Please sign in to comment.