Skip to content

Commit 76fd8c8

Browse files
committed
Add a new test
1 parent dc649bf commit 76fd8c8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

packages/compass-sidebar/src/components/multiple-connections/sidebar.spec.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,37 @@ describe('Multiple Connections Sidebar Component', function () {
357357
expect(screen.getByText('Remove')).to.be.visible;
358358
});
359359

360+
it('should render the only connected connections when toggled', async () => {
361+
await renderAndWaitForNavigationTree();
362+
363+
const activeConnectionsToggleButton = screen.getByLabelText(
364+
'Showing all connections'
365+
);
366+
367+
const connection1 = screen.getByTestId(savedFavoriteConnection.id);
368+
const connection2 = screen.getByTestId(savedRecentConnection.id);
369+
expect(connection1).to.be.visible;
370+
expect(connection2).to.be.visible;
371+
372+
userEvent.click(activeConnectionsToggleButton);
373+
expect(activeConnectionsToggleButton.ariaLabel).equals(
374+
'Showing active connections'
375+
);
376+
377+
screen.logTestingPlaygroundURL();
378+
379+
expect(connection1).to.not.exist;
380+
expect(connection2).to.not.exist;
381+
382+
await connectAndNotifyInstanceManager(savedFavoriteConnection);
383+
expect(connection1).to.exist;
384+
expect(connection2).to.not.exist;
385+
386+
await connectAndNotifyInstanceManager(savedRecentConnection);
387+
expect(connection1).to.exist;
388+
expect(connection2).to.exist;
389+
});
390+
360391
context('and performing actions', function () {
361392
beforeEach(async function () {
362393
await renderAndWaitForNavigationTree({

0 commit comments

Comments
 (0)