-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added interative conditionals + tests
- Loading branch information
Showing
7 changed files
with
190 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...ions/expression_partition_vis/public/expression_renderers/partition_vis_renderer.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
import { createMockPieParams, createMockVisData } from '../mocks'; | ||
import { CellValueAction } from '../types'; | ||
import { getColumnCellValueActions } from './partition_vis_renderer'; | ||
|
||
const visParams = createMockPieParams(); | ||
const visData = createMockVisData(); | ||
|
||
const cellValueAction: CellValueAction = { | ||
displayName: 'Test', | ||
id: 'test', | ||
iconType: 'test-icon', | ||
execute: () => {}, | ||
}; | ||
|
||
describe('getColumnCellValueActions', () => { | ||
it('should get column cellValue actions for each params bucket', async () => { | ||
const result = await getColumnCellValueActions(visParams, visData, async () => [ | ||
cellValueAction, | ||
]); | ||
expect(result).toHaveLength(visParams.dimensions.buckets?.length ?? 0); | ||
}); | ||
|
||
it('should contain the cellValue actions', async () => { | ||
const result = await getColumnCellValueActions(visParams, visData, async () => [ | ||
cellValueAction, | ||
cellValueAction, | ||
]); | ||
expect(result[0]).toEqual([cellValueAction, cellValueAction]); | ||
}); | ||
|
||
it('should return empty array if no buckets', async () => { | ||
const result = await getColumnCellValueActions( | ||
{ ...visParams, dimensions: { ...visParams.dimensions, buckets: undefined } }, | ||
visData, | ||
async () => [cellValueAction] | ||
); | ||
expect(result).toEqual([]); | ||
}); | ||
|
||
it('should return empty array if getCompatibleCellValueActions not passed', async () => { | ||
const result = await getColumnCellValueActions(visParams, visData, undefined); | ||
expect(result).toEqual([]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters