Skip to content

Commit

Permalink
fix(admin-ui): write test for all Gluu custom base UI components #290
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Oct 27, 2021
1 parent 5dcd4b6 commit df9c3e1
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/routes/Apps/Gluu/Tests/GluuAppSiderbar.test.js
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 GluuAppSidebar from '../GluuAppSidebar'
import i18n from '../../../../i18n'
import { I18nextProvider } from 'react-i18next'

it('Should show the sidebar properly', () => {
/* const scopes = []
render(
<I18nextProvider i18n={i18n}>
<GluuAppSidebar scopes={scopes} />
</I18nextProvider>,
)
screen.getByText('Sign out')
*/
})

18 changes: 18 additions & 0 deletions app/routes/Apps/Gluu/Tests/GluuInput.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react'
import { render, screen } from '@testing-library/react'
import GluuInput from '../GluuInput'
import i18n from '../../../../i18n'
import { I18nextProvider } from 'react-i18next'

it('Should show the input with proper text', () => {
const LABEL = 'fields.application_type'
const NAME = 'application_type'
const VALUE = 'Public'
render(
<I18nextProvider i18n={i18n}>
<GluuInput label={LABEL} value={VALUE} name={NAME} />
</I18nextProvider>,
)
screen.getByText('Application Type:')
expect(screen.getByDisplayValue(VALUE).id).toBe(NAME)
})
21 changes: 21 additions & 0 deletions app/routes/Apps/Gluu/Tests/GluuInputRow.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react'
import { render, screen } from '@testing-library/react'
import GluuInputRow from '../GluuInputRow'
import i18n from '../../../../i18n'
import { I18nextProvider } from 'react-i18next'
import { Formik } from 'formik'

it('Should show the input with proper text', () => {
const LABEL = 'fields.application_type'
const NAME = 'application_type'
const VALUE = 'Public'
function handler(){
}
render(
<I18nextProvider i18n={i18n}>
<GluuInputRow label={LABEL} value={VALUE} name={NAME} handler={handler} formik={handler}/>
</I18nextProvider>,
)
screen.getByText('Application Type:')
expect(screen.getByDisplayValue(VALUE).id).toBe(NAME)
})

0 comments on commit df9c3e1

Please sign in to comment.