Skip to content

Commit df9c3e1

Browse files
committed
fix(admin-ui): write test for all Gluu custom base UI components #290
1 parent 5dcd4b6 commit df9c3e1

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react'
2+
import { render, screen } from '@testing-library/react'
3+
import GluuAppSidebar from '../GluuAppSidebar'
4+
import i18n from '../../../../i18n'
5+
import { I18nextProvider } from 'react-i18next'
6+
7+
it('Should show the sidebar properly', () => {
8+
/* const scopes = []
9+
render(
10+
<I18nextProvider i18n={i18n}>
11+
<GluuAppSidebar scopes={scopes} />
12+
</I18nextProvider>,
13+
)
14+
screen.getByText('Sign out')
15+
*/
16+
})
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
import { render, screen } from '@testing-library/react'
3+
import GluuInput from '../GluuInput'
4+
import i18n from '../../../../i18n'
5+
import { I18nextProvider } from 'react-i18next'
6+
7+
it('Should show the input with proper text', () => {
8+
const LABEL = 'fields.application_type'
9+
const NAME = 'application_type'
10+
const VALUE = 'Public'
11+
render(
12+
<I18nextProvider i18n={i18n}>
13+
<GluuInput label={LABEL} value={VALUE} name={NAME} />
14+
</I18nextProvider>,
15+
)
16+
screen.getByText('Application Type:')
17+
expect(screen.getByDisplayValue(VALUE).id).toBe(NAME)
18+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import React from 'react'
2+
import { render, screen } from '@testing-library/react'
3+
import GluuInputRow from '../GluuInputRow'
4+
import i18n from '../../../../i18n'
5+
import { I18nextProvider } from 'react-i18next'
6+
import { Formik } from 'formik'
7+
8+
it('Should show the input with proper text', () => {
9+
const LABEL = 'fields.application_type'
10+
const NAME = 'application_type'
11+
const VALUE = 'Public'
12+
function handler(){
13+
}
14+
render(
15+
<I18nextProvider i18n={i18n}>
16+
<GluuInputRow label={LABEL} value={VALUE} name={NAME} handler={handler} formik={handler}/>
17+
</I18nextProvider>,
18+
)
19+
screen.getByText('Application Type:')
20+
expect(screen.getByDisplayValue(VALUE).id).toBe(NAME)
21+
})

0 commit comments

Comments
 (0)