Skip to content

Commit 7cb3315

Browse files
committed
add a test
1 parent d49a82a commit 7cb3315

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

packages/compass-connections/src/components/connection-status-notifications.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ const openConnectionFailedToast = (
161161
) => {
162162
const failedToastId = connectionInfo?.id ?? 'failed';
163163

164-
// TODO: close the existing connection toast and make a new one for the
165-
// failure so that the debug toast will appear below the failure one
164+
// TODO(COMPASS-9746): close the existing connection toast and make a new one
165+
// for the failure so that the debug toast will appear below the failure one
166166
openToast(`connection-status--${failedToastId}`, {
167167
title: error.message,
168168
description: (

packages/compass-connections/src/stores/connections-store-redux.spec.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,30 @@ describe('CompassConnections store', function () {
150150
}
151151
});
152152

153+
it('should show debug toast in addition to the connection error toast if connection fails and the assistant is enabled', async function () {
154+
const { connectionsStore } = renderCompassConnections({
155+
preferences: {
156+
enableAIAssistant: true,
157+
},
158+
connectFn: sinon
159+
.stub()
160+
.rejects(new Error('Failed to connect to cluster')),
161+
});
162+
163+
const connectionInfo = createDefaultConnectionInfo();
164+
165+
void connectionsStore.actions.connect(connectionInfo);
166+
167+
await waitFor(() => {
168+
expect(screen.getByText('Failed to connect to cluster')).to.exist;
169+
});
170+
171+
await waitFor(() => {
172+
expect(screen.getByText('Need help debugging your connection error?'))
173+
.to.exist;
174+
});
175+
});
176+
153177
it('should show non-genuine modal at the end of connection if non genuine mongodb detected', async function () {
154178
const { connectionsStore } = renderCompassConnections({});
155179

0 commit comments

Comments
 (0)