-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(admin-ui): write test for all Gluu custom base UI components #290
- Loading branch information
Showing
5 changed files
with
73 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import React from 'react' | ||
import GluuTypeAheadWithAdd from '../GluuTypeAheadWithAdd' | ||
import { render, screen, fireEvent } from '@testing-library/react' | ||
import i18n from '../../../../i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
it('Test GluuTypeAheadWithAdd component', () => { | ||
const LABEL = 'fields.application_type' | ||
let NAME = 'application_type' | ||
const VALUE = ['Monday'] | ||
const OPTIONS = ['Monday', 'Tuesday'] | ||
render( | ||
<I18nextProvider i18n={i18n}> | ||
<GluuTypeAheadWithAdd | ||
doc_category="openid_client" | ||
name={NAME} | ||
value={VALUE} | ||
label={LABEL} | ||
options={OPTIONS} | ||
/> | ||
</I18nextProvider>, | ||
) | ||
screen.getByText('Application Type:') | ||
screen.getByText('Add') | ||
screen.getByText('Remove') | ||
screen.getByText(VALUE[0]) | ||
}) |
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,26 @@ | ||
import React from 'react' | ||
import GluuViewWrapper from '../GluuViewWrapper' | ||
import { render, screen } from '@testing-library/react' | ||
import i18n from '../../../../i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
it('Check view wrapper with show', () => { | ||
let componentText = 'the wrapped component' | ||
render( | ||
<I18nextProvider i18n={i18n}> | ||
<GluuViewWrapper canShow> | ||
<p>{componentText}</p> | ||
</GluuViewWrapper> | ||
</I18nextProvider>, | ||
) | ||
screen.getByText(componentText) | ||
}) | ||
|
||
it('Check view wrapper with no show', () => { | ||
render( | ||
<I18nextProvider i18n={i18n}> | ||
<GluuViewWrapper /> | ||
</I18nextProvider>, | ||
) | ||
screen.getByText('Missing required permission') | ||
}) |
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,17 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import {LanguageMenu} from '../LanguageMenu' | ||
import i18n from '../../../../i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
it('All supported languages will be visible', () => { | ||
render( | ||
<I18nextProvider i18n={i18n}> | ||
<LanguageMenu /> | ||
</I18nextProvider>, | ||
) | ||
screen.getByText('en') | ||
screen.getByText('French') | ||
screen.getByText('English') | ||
screen.getByText('Portuguese') | ||
}) |