-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* tests Signed-off-by: Eric Wei <menwe@amazon.com> * updated some snapshots Signed-off-by: Eric Wei <menwe@amazon.com> * resolved few failing tests Signed-off-by: Eric Wei <menwe@amazon.com> * few modifications Signed-off-by: Eric Wei <menwe@amazon.com>
- Loading branch information
1 parent
154de24
commit 352316f
Showing
63 changed files
with
37,805 additions
and
315 deletions.
There are no files selected for viewing
430 changes: 430 additions & 0 deletions
430
...-observability/public/components/explorer/__tests__/__snapshots__/data_grid.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
211 changes: 211 additions & 0 deletions
211
...observability/public/components/explorer/__tests__/__snapshots__/no_results.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,211 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`No result component Renders No result component 1`] = ` | ||
<NoResults> | ||
<I18nProvider> | ||
<IntlProvider | ||
defaultLocale="en" | ||
formats={ | ||
Object { | ||
"date": Object { | ||
"full": Object { | ||
"day": "numeric", | ||
"month": "long", | ||
"weekday": "long", | ||
"year": "numeric", | ||
}, | ||
"long": Object { | ||
"day": "numeric", | ||
"month": "long", | ||
"year": "numeric", | ||
}, | ||
"medium": Object { | ||
"day": "numeric", | ||
"month": "short", | ||
"year": "numeric", | ||
}, | ||
"short": Object { | ||
"day": "numeric", | ||
"month": "numeric", | ||
"year": "2-digit", | ||
}, | ||
}, | ||
"number": Object { | ||
"currency": Object { | ||
"style": "currency", | ||
}, | ||
"percent": Object { | ||
"style": "percent", | ||
}, | ||
}, | ||
"relative": Object { | ||
"days": Object { | ||
"units": "day", | ||
}, | ||
"hours": Object { | ||
"units": "hour", | ||
}, | ||
"minutes": Object { | ||
"units": "minute", | ||
}, | ||
"months": Object { | ||
"units": "month", | ||
}, | ||
"seconds": Object { | ||
"units": "second", | ||
}, | ||
"years": Object { | ||
"units": "year", | ||
}, | ||
}, | ||
"time": Object { | ||
"full": Object { | ||
"hour": "numeric", | ||
"minute": "numeric", | ||
"second": "numeric", | ||
"timeZoneName": "short", | ||
}, | ||
"long": Object { | ||
"hour": "numeric", | ||
"minute": "numeric", | ||
"second": "numeric", | ||
"timeZoneName": "short", | ||
}, | ||
"medium": Object { | ||
"hour": "numeric", | ||
"minute": "numeric", | ||
"second": "numeric", | ||
}, | ||
"short": Object { | ||
"hour": "numeric", | ||
"minute": "numeric", | ||
}, | ||
}, | ||
} | ||
} | ||
locale="en" | ||
messages={Object {}} | ||
textComponent={Symbol(react.fragment)} | ||
> | ||
<PseudoLocaleWrapper> | ||
<EuiSpacer | ||
size="xl" | ||
> | ||
<div | ||
className="euiSpacer euiSpacer--xl" | ||
/> | ||
</EuiSpacer> | ||
<EuiFlexGroup | ||
justifyContent="center" | ||
> | ||
<div | ||
className="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--justifyContentCenter euiFlexGroup--directionRow euiFlexGroup--responsive" | ||
> | ||
<EuiFlexItem | ||
className="dscNoResults" | ||
grow={false} | ||
> | ||
<div | ||
className="euiFlexItem euiFlexItem--flexGrowZero dscNoResults" | ||
> | ||
<EuiCallOut | ||
color="warning" | ||
data-test-subj="discoverNoResults" | ||
iconType="help" | ||
title={ | ||
<FormattedMessage | ||
defaultMessage="No results match your search criteria" | ||
id="discover.noResults.searchExamples.noResultsMatchSearchCriteriaTitle" | ||
values={Object {}} | ||
/> | ||
} | ||
> | ||
<div | ||
className="euiCallOut euiCallOut--warning" | ||
data-test-subj="discoverNoResults" | ||
> | ||
<div | ||
className="euiCallOutHeader" | ||
> | ||
<EuiIcon | ||
aria-hidden="true" | ||
className="euiCallOutHeader__icon" | ||
size="m" | ||
type="help" | ||
> | ||
<EuiIconEmpty | ||
aria-hidden={true} | ||
className="euiIcon euiIcon--medium euiIcon-isLoading euiCallOutHeader__icon" | ||
focusable="false" | ||
role="img" | ||
style={null} | ||
> | ||
<svg | ||
aria-hidden={true} | ||
className="euiIcon euiIcon--medium euiIcon-isLoading euiCallOutHeader__icon" | ||
focusable="false" | ||
height={16} | ||
role="img" | ||
style={null} | ||
viewBox="0 0 16 16" | ||
width={16} | ||
xmlns="http://www.w3.org/2000/svg" | ||
/> | ||
</EuiIconEmpty> | ||
</EuiIcon> | ||
<span | ||
className="euiCallOutHeader__title" | ||
> | ||
<FormattedMessage | ||
defaultMessage="No results match your search criteria" | ||
id="discover.noResults.searchExamples.noResultsMatchSearchCriteriaTitle" | ||
values={Object {}} | ||
> | ||
No results match your search criteria | ||
</FormattedMessage> | ||
</span> | ||
</div> | ||
</div> | ||
</EuiCallOut> | ||
<EuiSpacer | ||
size="xl" | ||
> | ||
<div | ||
className="euiSpacer euiSpacer--xl" | ||
/> | ||
</EuiSpacer> | ||
<EuiText> | ||
<div | ||
className="euiText euiText--medium" | ||
> | ||
<h2 | ||
data-test-subj="discoverNoResultsTimefilter" | ||
> | ||
<FormattedMessage | ||
defaultMessage="Expand your time range or modify your query" | ||
id="discover.noResults.expandYourTimeRangeTitle" | ||
values={Object {}} | ||
> | ||
Expand your time range or modify your query | ||
</FormattedMessage> | ||
</h2> | ||
<p> | ||
<FormattedMessage | ||
defaultMessage="Your query may not match anything in the current time range, or there may not be any data at all in the currently selected time range. Try change time range, query filters or choose different time fields" | ||
id="discover.noResults.queryMayNotMatchTitle" | ||
values={Object {}} | ||
> | ||
Your query may not match anything in the current time range, or there may not be any data at all in the currently selected time range. Try change time range, query filters or choose different time fields | ||
</FormattedMessage> | ||
</p> | ||
</div> | ||
</EuiText> | ||
</div> | ||
</EuiFlexItem> | ||
</div> | ||
</EuiFlexGroup> | ||
</PseudoLocaleWrapper> | ||
</IntlProvider> | ||
</I18nProvider> | ||
</NoResults> | ||
`; |
48 changes: 48 additions & 0 deletions
48
dashboards-observability/public/components/explorer/__tests__/data_grid.test.tsx
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,48 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { configure, mount } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import React from 'react'; | ||
import { waitFor } from '@testing-library/react'; | ||
import { DataGrid } from '../data_grid'; | ||
import { | ||
SELECTED_FIELDS, | ||
AVAILABLE_FIELDS, | ||
UNSELECTED_FIELDS, | ||
QUERIED_FIELDS | ||
} from '../../../../common/constants/explorer'; | ||
import { | ||
AVAILABLE_FIELDS as SIDEBAR_AVAILABLE_FIELDS, | ||
QUERY_FIELDS, | ||
DATA_GRID_ROWS | ||
} from '../../../../test/event_analytics_constants'; | ||
|
||
describe('Datagrid component', () => { | ||
configure({ adapter: new Adapter() }); | ||
|
||
it('Renders data grid component', async () => { | ||
const explorerFields = { | ||
[SELECTED_FIELDS]: [], | ||
[UNSELECTED_FIELDS]: [], | ||
[AVAILABLE_FIELDS]: SIDEBAR_AVAILABLE_FIELDS, | ||
[QUERIED_FIELDS]: QUERY_FIELDS | ||
}; | ||
|
||
const wrapper = mount( | ||
<DataGrid | ||
rows={DATA_GRID_ROWS} | ||
rowsAll={[]} | ||
explorerFields={explorerFields} | ||
/> | ||
); | ||
|
||
wrapper.update(); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
54 changes: 54 additions & 0 deletions
54
dashboards-observability/public/components/explorer/__tests__/explorer.test.tsx
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,54 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { configure, mount } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import React from 'react'; | ||
import { waitFor } from '@testing-library/react'; | ||
import httpClientMock from '../../../../test/__mocks__/httpClientMock'; | ||
import { Explorer } from '../explorer'; | ||
import PPLService from '../../../services/requests/ppl'; | ||
import DSLService from '../../../services/requests/dsl'; | ||
import SavedObjects from '../../../services/saved_objects/event_analytics/saved_objects'; | ||
import TimestampUtils from '../../../services/timestamp/timestamp'; | ||
import { coreStartMock } from '../../../../test/__mocks__/coreMocks'; | ||
|
||
describe.skip('Event explorer component', () => { | ||
configure({ adapter: new Adapter() }); | ||
|
||
it('Renders explorer component', async () => { | ||
const pplService = new PPLService(httpClientMock); | ||
const dslService = new DSLService(httpClientMock); | ||
const tabId = 'query-panel-1'; | ||
const savedObjects = new SavedObjects(httpClientMock); | ||
const timestampUtils = new TimestampUtils(dslService); | ||
const setToast = jest.fn(); | ||
const history = jest.fn() as any; | ||
history.replace = jest.fn(); | ||
history.push = jest.fn(); | ||
const notifications = coreStartMock.notifications; | ||
const savedObjectId = 'JIcoln0BYMuJGDsOLTnM'; | ||
|
||
const wrapper = mount( | ||
<Explorer | ||
pplService={pplService} | ||
dslService={dslService} | ||
tabId={tabId} | ||
savedObjects={savedObjects} | ||
timestampUtils={timestampUtils} | ||
setToast={setToast} | ||
history={history} | ||
notifications={notifications} | ||
savedObjectId={savedObjectId} | ||
/> | ||
); | ||
|
||
wrapper.update(); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
dashboards-observability/public/components/explorer/__tests__/no_results.test.tsx
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,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { configure, mount } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import React from 'react'; | ||
import { waitFor } from '@testing-library/react'; | ||
import { NoResults } from '../no_results'; | ||
|
||
describe('No result component', () => { | ||
configure({ adapter: new Adapter() }); | ||
|
||
it('Renders No result component', async () => { | ||
|
||
const wrapper = mount( | ||
<NoResults /> | ||
); | ||
|
||
wrapper.update(); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.