-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK-3087] Captcha for single enterprise AD connections (#2096)
* Add Captcha to HRDPane * Add tests for enterprise AD captcha * Update broken test * Add component test for HRDPane * Attempt to fix a race condition in a test
- Loading branch information
1 parent
7552d24
commit dce864a
Showing
9 changed files
with
449 additions
and
79 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
src/__tests__/connection/enterprise/__snapshots__/hrd_pane.test.js.snap
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,100 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`HRDPane renders correctly 1`] = ` | ||
<div> | ||
<header /> | ||
<UsernamePane | ||
i18n={ | ||
Object { | ||
"group": [Function], | ||
"html": [Function], | ||
"initI18n": [Function], | ||
"str": [Function], | ||
} | ||
} | ||
lock={ | ||
Immutable.Map { | ||
"id": "__lock-id__", | ||
} | ||
} | ||
placeholder="username" | ||
strictValidation={false} | ||
usernameStyle="username" | ||
validateFormat={false} | ||
/> | ||
<PasswordPane | ||
i18n={ | ||
Object { | ||
"group": [Function], | ||
"html": [Function], | ||
"initI18n": [Function], | ||
"str": [Function], | ||
} | ||
} | ||
lock={ | ||
Immutable.Map { | ||
"id": "__lock-id__", | ||
} | ||
} | ||
placeholder="password" | ||
/> | ||
</div> | ||
`; | ||
|
||
exports[`HRDPane renders the captcha if required 1`] = ` | ||
<div> | ||
<header /> | ||
<UsernamePane | ||
i18n={ | ||
Object { | ||
"group": [Function], | ||
"html": [Function], | ||
"initI18n": [Function], | ||
"str": [Function], | ||
} | ||
} | ||
lock={ | ||
Immutable.Map { | ||
"id": "__lock-id__", | ||
} | ||
} | ||
placeholder="username" | ||
strictValidation={false} | ||
usernameStyle="username" | ||
validateFormat={false} | ||
/> | ||
<PasswordPane | ||
i18n={ | ||
Object { | ||
"group": [Function], | ||
"html": [Function], | ||
"initI18n": [Function], | ||
"str": [Function], | ||
} | ||
} | ||
lock={ | ||
Immutable.Map { | ||
"id": "__lock-id__", | ||
} | ||
} | ||
placeholder="password" | ||
/> | ||
<CaptchaPane | ||
error={false} | ||
i18n={ | ||
Object { | ||
"group": [Function], | ||
"html": [Function], | ||
"initI18n": [Function], | ||
"str": [Function], | ||
} | ||
} | ||
lock={ | ||
Immutable.Map { | ||
"id": "__lock-id__", | ||
} | ||
} | ||
onReload={[Function]} | ||
/> | ||
</div> | ||
`; |
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,37 @@ | ||
import React from 'react'; | ||
import { expectShallowComponent } from 'testUtils'; | ||
import I from 'immutable'; | ||
import * as i18n from '../../../i18n'; | ||
import HRDPane from '../../../connection/enterprise/hrd_pane'; | ||
|
||
const lock = I.fromJS({ id: '__lock-id__' }); | ||
|
||
jest.mock('core/index'); | ||
|
||
describe('HRDPane', () => { | ||
const defaultProps = { | ||
model: lock, | ||
header: <header></header>, | ||
i18n, | ||
passwordInputPlaceholder: 'password', | ||
usernameInputPlaceholder: 'username' | ||
}; | ||
|
||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
it('renders correctly', () => { | ||
expectShallowComponent(<HRDPane {...defaultProps} />).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders the captcha if required', () => { | ||
require('core/index').captcha.mockReturnValue({ | ||
get() { | ||
return true; | ||
} | ||
}); | ||
|
||
expectShallowComponent(<HRDPane {...defaultProps} />).toMatchSnapshot(); | ||
}); | ||
}); |
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
Oops, something went wrong.