-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #467 from GatherPress/mauteri-updates-4
Added tests for OnlineEvent component.
- Loading branch information
Showing
7 changed files
with
81 additions
and
0 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
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
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,39 @@ | ||
/** | ||
* External dependencies. | ||
*/ | ||
import { render } from '@testing-library/react'; | ||
import { expect, test } from '@jest/globals'; | ||
import '@testing-library/jest-dom'; | ||
|
||
/** | ||
* Internal dependencies. | ||
*/ | ||
import OnlineEvent from '../../../../../src/components/OnlineEvent'; | ||
|
||
/** | ||
* Coverage for OnlineEvent. | ||
*/ | ||
test('OnlineEvent renders component without link', () => { | ||
const { container } = render(<OnlineEvent />); | ||
|
||
expect(container).toHaveTextContent('Online event'); | ||
expect(container.children[0].children[0].children[0]).toHaveClass( | ||
'dashicon dashicons dashicons-video-alt2' | ||
); | ||
expect(container.children[0].children[1].children[0]).toHaveClass( | ||
'gp-tooltip' | ||
); | ||
}); | ||
|
||
test('OnlineEvent renders component with link', () => { | ||
const link = 'https://unit.test/chat/'; | ||
const { container } = render(<OnlineEvent onlineEventLinkDefault={link} />); | ||
|
||
expect(container).toHaveTextContent('Online event'); | ||
expect(container.children[0].children[0].children[0]).toHaveClass( | ||
'dashicon dashicons dashicons-video-alt2' | ||
); | ||
expect( | ||
container.children[0].children[1].children[0].getAttribute('href') | ||
).toBe(link); | ||
}); |