-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into read-only-tenant-logic-poc
Signed-off-by: Kajetan Nobel <kajetan.nobel@eliatra.com>
- Loading branch information
Showing
4 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
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
39 changes: 39 additions & 0 deletions
39
public/apps/customerror/test/__snapshots__/custom-error.test.tsx.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,39 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Custom error page test renders and clicks the button on the error page 1`] = ` | ||
<EuiListGroup | ||
className="custom-error-wrapper" | ||
> | ||
<EuiSpacer | ||
size="s" | ||
/> | ||
<EuiText | ||
size="m" | ||
textAlign="center" | ||
> | ||
<h3> | ||
Title | ||
</h3> | ||
</EuiText> | ||
<EuiSpacer | ||
size="s" | ||
/> | ||
<EuiText | ||
size="s" | ||
textAlign="center" | ||
> | ||
Sub Title | ||
</EuiText> | ||
<EuiSpacer | ||
size="s" | ||
/> | ||
<EuiButton | ||
data-test-subj="error-logout-button" | ||
fill={true} | ||
fullWidth={true} | ||
onClick={[Function]} | ||
> | ||
Logout | ||
</EuiButton> | ||
</EuiListGroup> | ||
`; |
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,61 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
import { shallow } from 'enzyme'; | ||
import React from 'react'; | ||
import { CustomErrorPage } from '../custom-error'; | ||
import { cleanup } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { EuiButton } from '../custom-error'; | ||
import { logout } from '../../account/utils'; | ||
|
||
afterEach(() => { | ||
cleanup(); | ||
}); | ||
|
||
describe('Custom error page test', () => { | ||
let component; | ||
|
||
beforeEach(() => { | ||
component = shallow( | ||
<EuiButton fill onClick={logout} data-test-subj="error-logout-button" fullWidth> | ||
Logout | ||
</EuiButton> | ||
); | ||
}); | ||
|
||
it('renders and clicks the button on the error page', () => { | ||
const wrapper = shallow( | ||
<CustomErrorPage | ||
title="Title" | ||
subtitle="Sub Title" | ||
http={undefined} | ||
chrome={undefined} | ||
config={{ | ||
title: '', | ||
subtitle: '', | ||
showbrandimage: false, | ||
brandimage: '', | ||
buttonstyle: '', | ||
}} | ||
/> | ||
); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
|
||
component.find('[data-test-subj="error-logout-button"]').simulate('onClick', { | ||
preventDefault: () => {}, | ||
}); | ||
}); | ||
}); |