-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7578a2e
commit bd12bea
Showing
2 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
...yEditor/modeledDataStreamQueryEditor/assetExplorer/assetTable/assetTableNameLink.spec.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,29 @@ | ||
import React from 'react'; | ||
import { render, fireEvent } from '@testing-library/react'; | ||
import { AssetTableNameLink } from './assetTableNameLink'; | ||
|
||
test('renders Link component with correct ariaLabel and onFollow event', () => { | ||
const assetId = '123'; | ||
const assetName = 'Demo Asset Wind Farm'; | ||
const updateParentAssetId = jest.fn(); | ||
|
||
const { getByText, getByTestId } = render( | ||
<AssetTableNameLink | ||
assetId={assetId} | ||
assetName={assetName} | ||
updateParentAssetId={updateParentAssetId} | ||
/> | ||
); | ||
const link = getByText(assetName); | ||
|
||
expect(link).toBeInTheDocument(); | ||
|
||
const linkText = getByTestId('asset-name-link'); | ||
expect(linkText).toHaveAttribute( | ||
'title', | ||
`View children assets of ${assetName}` | ||
); | ||
|
||
fireEvent.click(link); | ||
expect(updateParentAssetId).toHaveBeenCalledWith(assetId); | ||
}); |
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