-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EDSC-4322: Add tests and fix one test mistake
- Loading branch information
1 parent
2c66bc9
commit 73f3785
Showing
3 changed files
with
65 additions
and
28 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
59 changes: 59 additions & 0 deletions
59
...onents/AvailableCustomizationsIcons/__tests__/AvailableCustomizationsTooltipIcons.test.js
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,59 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
|
||
import AvailableCustomizationsTooltipIcons from '../AvailableCustomizationsTooltipIcons' | ||
|
||
const setup = (overrideProps) => { | ||
const props = { | ||
hasSpatialSubsetting: true, | ||
hasVariables: true, | ||
hasTransforms: true, | ||
hasFormats: true, | ||
hasTemporalSubsetting: true, | ||
hasCombine: true, | ||
...overrideProps | ||
} | ||
|
||
return render( | ||
<AvailableCustomizationsTooltipIcons {...props} /> | ||
) | ||
} | ||
|
||
describe('AvailableCustomizationsTooltipIcons component', () => { | ||
test('on load should contain all of the custom icons for the customizable options', () => { | ||
setup() | ||
|
||
// Ensure that each of the icons rendered | ||
expect(screen.getByTitle('A white clock icon')).toBeInTheDocument() | ||
expect(screen.getByTitle('A white tags icon')).toBeInTheDocument() | ||
expect(screen.getByTitle('A white horizontal sliders icon')).toBeInTheDocument() | ||
expect(screen.getByTitle('A white file icon')).toBeInTheDocument() | ||
expect(screen.getByTitle('A white cubes icon')).toBeInTheDocument() | ||
}) | ||
|
||
test('ensure Tool-Tip content are list items', () => { | ||
setup() | ||
const iconListItemsCount = screen.getAllByRole('listitem').length | ||
// Ensure that each of the icons rendered | ||
expect(iconListItemsCount).toEqual(6) | ||
}) | ||
|
||
describe('when some of the dat customizations are not supported', () => { | ||
test('those icons do not render', () => { | ||
setup({ | ||
hasVariables: false, | ||
hasCombine: false | ||
}) | ||
|
||
// Ensure that each of the icons that are supposed to render do | ||
expect(screen.getByTitle('A white globe icon')).toBeInTheDocument() | ||
expect(screen.getByTitle('A white clock icon')).toBeInTheDocument() | ||
expect(screen.getByTitle('A white horizontal sliders icon')).toBeInTheDocument() | ||
expect(screen.getByTitle('A white file icon')).toBeInTheDocument() | ||
|
||
// Ensure that the icons for `hasVariables` and `hasCombine` which were passed false do not render | ||
expect(screen.queryByTitle('A white cubes icon')).not.toBeInTheDocument() | ||
expect(screen.queryByTitle('A white tags icon')).not.toBeInTheDocument() | ||
}) | ||
}) | ||
}) |