Skip to content

Commit

Permalink
Add component test for HRDPane
Browse files Browse the repository at this point in the history
  • Loading branch information
stevehobbsdev committed Feb 6, 2022
1 parent aeba229 commit d95c7d5
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 0 deletions.
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>
`;
37 changes: 37 additions & 0 deletions src/__tests__/connection/enterprise/hrd_pane.test.js
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();
});
});

0 comments on commit d95c7d5

Please sign in to comment.