-
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.
feat: write test for the pages under admin plugin #302
- Loading branch information
1 parent
c88ca52
commit 37275a9
Showing
6 changed files
with
1,338 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
plugins/admin/components/Configuration/LicenseDetailsForm.test.js
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,24 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import LicenseDetailsForm from './LicenseDetailsForm' | ||
import license from "./license" | ||
import i18n from '../../../../app/i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
const Wrapper = ({ children }) => ( | ||
<I18nextProvider i18n={i18n}>{children}</I18nextProvider> | ||
) | ||
const permissions = [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/attributes.write', | ||
'https://jans.io/oauth/config/attributes.delete', | ||
] | ||
const item = license[0] | ||
it('Should render the license detail page properly', () => { | ||
render(<LicenseDetailsForm item={item} permissions={permissions} />, { | ||
wrapper: Wrapper, | ||
}) | ||
screen.getByText(/License Valid Upto/) | ||
screen.getByText(/Maximum Activations/) | ||
screen.getByText(/Is License Active/) | ||
}) |
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 @@ | ||
export const license = [ | ||
{ | ||
companyName: "Gluu", | ||
customerEmail: "arnab@gluu.org", | ||
customerFirstName: "Arnab", | ||
customerLastName: "Dutta", | ||
licenseActive: true, | ||
licenseEnable: true, | ||
licenseKey: "GFXJ-AB8B-YDJK-L4AD", | ||
licenseType: "TIME_LIMITED", | ||
maxActivations: 14, | ||
productCode: "adminui001", | ||
productName: "Gluu Admin UI", | ||
validityPeriod: "2022-10-01T00:00Z", | ||
} | ||
] | ||
export default license |
28 changes: 28 additions & 0 deletions
28
plugins/admin/components/CustomScripts/CustomScriptDetailPage.test.js
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,28 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import CustomScriptDetailPage from './CustomScriptDetailPage' | ||
import item from "./item" | ||
import i18n from '../../../../app/i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
const Wrapper = ({ children }) => ( | ||
<I18nextProvider i18n={i18n}>{children}</I18nextProvider> | ||
) | ||
const permissions = [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/attributes.write', | ||
'https://jans.io/oauth/config/attributes.delete', | ||
] | ||
|
||
it('Should render the Custom Script detail page properly', () => { | ||
render(<CustomScriptDetailPage row={item} permissions={permissions} />, { | ||
wrapper: Wrapper, | ||
}) | ||
const name = item.name | ||
const script_type = item.scriptType | ||
screen.getByText(/Inum/) | ||
screen.getByText(/Location Type/) | ||
screen.getByText(/Script Type/) | ||
screen.getByText(name) | ||
screen.getByText(script_type) | ||
}) |
27 changes: 27 additions & 0 deletions
27
plugins/admin/components/CustomScripts/CustomScriptForm.test.js
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 { render, screen } from '@testing-library/react' | ||
import CustomScriptForm from './CustomScriptForm' | ||
import item from "./item" | ||
import script from "./script" | ||
import i18n from '../../../../app/i18n' | ||
import { I18nextProvider } from 'react-i18next' | ||
|
||
const Wrapper = ({ children }) => ( | ||
<I18nextProvider i18n={i18n}>{children}</I18nextProvider> | ||
) | ||
const permissions = [ | ||
'https://jans.io/oauth/config/attributes.readonly', | ||
'https://jans.io/oauth/config/attributes.write', | ||
'https://jans.io/oauth/config/attributes.delete', | ||
] | ||
|
||
it('Should render the Custom Script detail page properly', () => { | ||
render(<CustomScriptForm item={item} scripts={script} permissions={permissions} />, { | ||
wrapper: Wrapper, | ||
}) | ||
const inum = item.inum | ||
screen.getByText(/Inum/) | ||
screen.getByText(/Name/) | ||
screen.getByText(/Script/) | ||
screen.getByText(inum) | ||
}) |
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,28 @@ | ||
export const item = { | ||
name: "basic", | ||
script: "", | ||
scriptType: "PERSON_AUTHENTICATION", | ||
programmingLanguage: "PYTHON", | ||
moduleProperties: [ | ||
{ | ||
value1: "usage_type", | ||
value2: "interactive" | ||
}, | ||
{ | ||
value1: "location_type", | ||
value2: "ldap" | ||
} | ||
], | ||
level: 10, | ||
dn: "inum=A51E-76DA,ou=scripts,o=jans", | ||
inum: "A51E-76DA", | ||
description: "Sample authentication module", | ||
revision: 1, | ||
enabled: false, | ||
modified: false, | ||
internal: false, | ||
tableData: { | ||
id: 0 | ||
} | ||
} | ||
export default item |
Oops, something went wrong.