-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'featureAnywhere' into bugbash
Signed-off-by: Jackie Han <hnyng@amazon.com>
- Loading branch information
Showing
19 changed files
with
725 additions
and
134 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1,2 +1 @@ | ||
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams | ||
* @opensearch-project/anomaly-detection | ||
* @ohltyler @kaituo @jackiehanyang @amitgalitz @sean-zheng-amazon |
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
69 changes: 69 additions & 0 deletions
69
...eContextMenu/AssociatedDetectors/components/__tests__/ConfirmUnlinkDetectorModal.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,69 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { findAllByTestId, render, waitFor } from '@testing-library/react'; | ||
import { ConfirmUnlinkDetectorModal } from '../index'; | ||
import { getRandomDetector } from '../../../../../../public/redux/reducers/__tests__/utils'; | ||
import { DetectorListItem } from '../../../../../../public/models/interfaces'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
describe('ConfirmUnlinkDetectorModal spec', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
const testDetectors = [ | ||
{ | ||
id: 'detectorId1', | ||
name: 'test-detector-1', | ||
}, | ||
{ | ||
id: 'detectorId2', | ||
name: 'test-detector-2', | ||
}, | ||
] as DetectorListItem[]; | ||
|
||
const ConfirmUnlinkDetectorModalProps = { | ||
detector: testDetectors[0], | ||
onHide: jest.fn(), | ||
onConfirm: jest.fn(), | ||
onUnlinkDetector: jest.fn(), | ||
isListLoading: false, | ||
}; | ||
|
||
test('renders the component correctly', () => { | ||
const { container, getByText } = render( | ||
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} /> | ||
); | ||
getByText('Remove association?'); | ||
getByText( | ||
'Removing association unlinks test-detector-1 detector from the visualization but does not delete it. The detector association can be restored.' | ||
); | ||
}); | ||
test('should call onConfirm() when closing', async () => { | ||
const { container, getByText, getByTestId } = render( | ||
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} /> | ||
); | ||
getByText('Remove association?'); | ||
userEvent.click(getByTestId('confirmUnlinkButton')); | ||
expect(ConfirmUnlinkDetectorModalProps.onConfirm).toHaveBeenCalled(); | ||
}); | ||
test('should call onConfirm() when closing', async () => { | ||
const { container, getByText, getByTestId } = render( | ||
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} /> | ||
); | ||
getByText('Remove association?'); | ||
userEvent.click(getByTestId('confirmUnlinkButton')); | ||
expect(ConfirmUnlinkDetectorModalProps.onConfirm).toHaveBeenCalled(); | ||
}); | ||
test('should call onHide() when closing', async () => { | ||
const { getByTestId } = render( | ||
<ConfirmUnlinkDetectorModal {...ConfirmUnlinkDetectorModalProps} /> | ||
); | ||
userEvent.click(getByTestId('cancelUnlinkButton')); | ||
expect(ConfirmUnlinkDetectorModalProps.onHide).toHaveBeenCalled(); | ||
}); | ||
}); |
40 changes: 40 additions & 0 deletions
40
...textMenu/AssociatedDetectors/components/__tests__/EmptyAssociatedDetectorMessage.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,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { findAllByTestId, render, waitFor } from '@testing-library/react'; | ||
import { EmptyAssociatedDetectorMessage } from '../index'; | ||
import { getRandomDetector } from '../../../../../../public/redux/reducers/__tests__/utils'; | ||
import { DetectorListItem } from '../../../../../../public/models/interfaces'; | ||
import userEvent from '@testing-library/user-event'; | ||
|
||
describe('ConfirmUnlinkDetectorModal spec', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
test('renders the component with filter applied', () => { | ||
const { container, getByText } = render( | ||
<EmptyAssociatedDetectorMessage | ||
isFilterApplied={true} | ||
embeddableTitle="test-title" | ||
/> | ||
); | ||
getByText('There are no detectors matching your search'); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
test('renders the component with filter applied', () => { | ||
const { container, getByText } = render( | ||
<EmptyAssociatedDetectorMessage | ||
isFilterApplied={false} | ||
embeddableTitle="test-title" | ||
/> | ||
); | ||
getByText( | ||
'There are no anomaly detectors associated with test-title visualization.' | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
69 changes: 69 additions & 0 deletions
69
...Detectors/components/__tests__/__snapshots__/EmptyAssociatedDetectorMessage.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,69 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`ConfirmUnlinkDetectorModal spec renders the component with filter applied 1`] = ` | ||
<div> | ||
<div | ||
class="euiEmptyPrompt" | ||
data-test-subj="emptyAssociatedDetectorFlyoutMessage" | ||
style="max-width: 45em;" | ||
> | ||
<h3 | ||
class="euiTitle euiTitle--small" | ||
> | ||
No anomaly detectors to display | ||
</h3> | ||
<span | ||
class="euiTextColor euiTextColor--subdued" | ||
> | ||
<div | ||
class="euiSpacer euiSpacer--m" | ||
/> | ||
<div | ||
class="euiText euiText--medium" | ||
> | ||
<div | ||
class="euiText euiText--medium" | ||
> | ||
<p> | ||
There are no detectors matching your search | ||
</p> | ||
</div> | ||
</div> | ||
</span> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`ConfirmUnlinkDetectorModal spec renders the component with filter applied 2`] = ` | ||
<div> | ||
<div | ||
class="euiEmptyPrompt" | ||
data-test-subj="emptyAssociatedDetectorFlyoutMessage" | ||
style="max-width: 45em;" | ||
> | ||
<h3 | ||
class="euiTitle euiTitle--small" | ||
> | ||
No anomaly detectors to display | ||
</h3> | ||
<span | ||
class="euiTextColor euiTextColor--subdued" | ||
> | ||
<div | ||
class="euiSpacer euiSpacer--m" | ||
/> | ||
<div | ||
class="euiText euiText--medium" | ||
> | ||
<div | ||
class="euiText euiText--medium" | ||
> | ||
<p> | ||
There are no anomaly detectors associated with test-title visualization. | ||
</p> | ||
</div> | ||
</div> | ||
</span> | ||
</div> | ||
</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 |
---|---|---|
|
@@ -16,4 +16,8 @@ | |
&__flex-group { | ||
height: 100%; | ||
} | ||
|
||
&__associate-button { | ||
flex: 0 0 auto; | ||
} | ||
} |
Oops, something went wrong.