mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Fix UT
This commit is contained in:
parent
57a88706a1
commit
8c0ae96edc
@ -32,6 +32,7 @@ exports[`screen picker should render correctly 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="ScreenPicker-error-content"
|
className="ScreenPicker-error-content"
|
||||||
|
key="spec"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className="error-message"
|
className="error-message"
|
||||||
|
@ -9,6 +9,10 @@ describe('basic auth', () => {
|
|||||||
const passwordTargetMock: object = {
|
const passwordTargetMock: object = {
|
||||||
target: { id: 'password', value: '123456' },
|
target: { id: 'password', value: '123456' },
|
||||||
};
|
};
|
||||||
|
const defaultState: object = {
|
||||||
|
hostname: 'unknown',
|
||||||
|
isValidCredentials: true,
|
||||||
|
};
|
||||||
const basicAuthMock: object = {
|
const basicAuthMock: object = {
|
||||||
hostname: 'example',
|
hostname: 'example',
|
||||||
isValidCredentials: true,
|
isValidCredentials: true,
|
||||||
@ -27,9 +31,13 @@ describe('basic auth', () => {
|
|||||||
const spy: jest.SpyInstance = jest.spyOn(BasicAuth.prototype, 'setState');
|
const spy: jest.SpyInstance = jest.spyOn(BasicAuth.prototype, 'setState');
|
||||||
const wrapper: ShallowWrapper = shallow(React.createElement(BasicAuth));
|
const wrapper: ShallowWrapper = shallow(React.createElement(BasicAuth));
|
||||||
wrapper.find('#username').simulate('change', usernameTargetMock);
|
wrapper.find('#username').simulate('change', usernameTargetMock);
|
||||||
expect(spy).lastCalledWith(usernameMock);
|
expect(spy).lastCalledWith({ ...defaultState, ...usernameMock });
|
||||||
wrapper.find('#password').simulate('change', passwordTargetMock);
|
wrapper.find('#password').simulate('change', passwordTargetMock);
|
||||||
expect(spy).lastCalledWith(passwordMock);
|
expect(spy).lastCalledWith({
|
||||||
|
...defaultState,
|
||||||
|
...usernameMock,
|
||||||
|
...passwordMock,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call submit login', () => {
|
it('should call submit login', () => {
|
||||||
|
@ -205,7 +205,7 @@ export default class ScreenPicker extends React.Component<{}, IState> {
|
|||||||
this.isApplicationsAvailable = applications.length > 0;
|
this.isApplicationsAvailable = applications.length > 0;
|
||||||
if (!this.isScreensAvailable && !this.isApplicationsAvailable) {
|
if (!this.isScreensAvailable && !this.isApplicationsAvailable) {
|
||||||
return (
|
return (
|
||||||
<div className='ScreenPicker-error-content'>
|
<div className='ScreenPicker-error-content' key='spec'>
|
||||||
<span className='error-message'>
|
<span className='error-message'>
|
||||||
{i18n.t(
|
{i18n.t(
|
||||||
'No screens or applications are currently available.',
|
'No screens or applications are currently available.',
|
||||||
@ -217,7 +217,7 @@ export default class ScreenPicker extends React.Component<{}, IState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='ScreenPicker-main-content'>
|
<div className='ScreenPicker-main-content' key='spmc'>
|
||||||
{this.renderTabTitles()}
|
{this.renderTabTitles()}
|
||||||
<section id='screen-contents'>{screens}</section>
|
<section id='screen-contents'>{screens}</section>
|
||||||
<section id='application-contents'> {applications}</section>
|
<section id='application-contents'> {applications}</section>
|
||||||
|
Loading…
Reference in New Issue
Block a user