Skip to content

Commit

Permalink
fix(admin-ui): code smells in test cases auth-server
Browse files Browse the repository at this point in the history
  • Loading branch information
jv18creator committed Aug 4, 2023
1 parent eae73ba commit 582905b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions admin-ui/plugins/auth-server/_tests_/api/Agama.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { expectSaga } from 'redux-saga-test-plan'
import authReducer from 'Redux/features/authSlice'
import {
getAgamas,
addAgama,
deleteAgamas,
// addAgama,
// deleteAgamas,
} from 'Plugins/auth-server/redux/sagas/AgamaSaga'
import {
initialState as agamaInitState,
Expand Down
3 changes: 1 addition & 2 deletions admin-ui/plugins/auth-server/_tests_/api/AuthN.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ const rootReducer = combineReducers({
})

describe('api tests for authn module', () => {
let defaultAuthNMethod
it('should get custom script by type person_authentication', async () => {
const result = await expectSaga(getScriptsByType, {
payload: { action: { type: 'person_authentication' } },
})
.withReducer(rootReducer, initialState)
.silentRun(false)

defaultAuthNMethod = result.returnValue?.entries?.find(
result.returnValue?.entries?.find(
(item) => item.name === 'simple_password_auth'
)
expect(result.returnValue instanceof Error).toBe(false)
Expand Down
2 changes: 1 addition & 1 deletion admin-ui/plugins/auth-server/_tests_/api/Ssa.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('test create, read & delete actions for ssa module', () => {

it('should delete newly created config', async () => {
if (newConfig) {
const result = await expectSaga(removeSsaConfig, {
await expectSaga(removeSsaConfig, {
payload: { action: { action_data: newConfig.ssa.jti } },
})
.withReducer(rootReducer, initialState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function AuthNEditPage() {
const payload = {}

if (item.name === "simple_password_auth") {
if (data.defaultAuthNMethod == "true" || data.defaultAuthNMethod == true) {
if (data.defaultAuthNMethod === "true" || data.defaultAuthNMethod === true) {
payload.authenticationMethod = { defaultAcr: "simple_password_auth" }
dispatch(editSimpleAuthAcr({ data: payload }))
}
Expand All @@ -52,7 +52,7 @@ function AuthNEditPage() {
ldapPayload.useSSL = data.useSSL
ldapPayload.enabled = data.enabled

if (data.defaultAuthNMethod == "true" || data.defaultAuthNMethod == true) {
if (data.defaultAuthNMethod === "true" || data.defaultAuthNMethod === true) {
payload.authenticationMethod = { defaultAcr: data.configId }
dispatch(editSimpleAuthAcr({ data: payload }))
}
Expand All @@ -75,7 +75,7 @@ function AuthNEditPage() {
hide: false,
}))
}
if (data.defaultAuthNMethod == "true" || data.defaultAuthNMethod == true) {
if (data.defaultAuthNMethod === "true" || data.defaultAuthNMethod === true) {
payload.authenticationMethod = { defaultAcr: item.acrName }
dispatch(editSimpleAuthAcr({ data: payload }))
}
Expand Down

0 comments on commit 582905b

Please sign in to comment.