Skip to content

Commit da444ea

Browse files
committed
fixup! Add a new test
Use queryByTestId to fix test
1 parent 76fd8c8 commit da444ea

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -364,28 +364,37 @@ describe('Multiple Connections Sidebar Component', function () {
364364
'Showing all connections'
365365
);
366366

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;
367+
{
368+
expect(screen.queryByTestId(savedFavoriteConnection.id)).to.be
369+
.visible;
370+
expect(screen.queryByTestId(savedRecentConnection.id)).to.be
371+
.visible;
372+
}
371373

372374
userEvent.click(activeConnectionsToggleButton);
373375
expect(activeConnectionsToggleButton.ariaLabel).equals(
374376
'Showing active connections'
375377
);
376378

377-
screen.logTestingPlaygroundURL();
378-
379-
expect(connection1).to.not.exist;
380-
expect(connection2).to.not.exist;
379+
{
380+
expect(screen.queryByTestId(savedFavoriteConnection.id)).to.be.null;
381+
expect(screen.queryByTestId(savedRecentConnection.id)).to.be.null;
382+
}
381383

382384
await connectAndNotifyInstanceManager(savedFavoriteConnection);
383-
expect(connection1).to.exist;
384-
expect(connection2).to.not.exist;
385+
{
386+
expect(screen.queryByTestId(savedFavoriteConnection.id)).to.be
387+
.visible;
388+
expect(screen.queryByTestId(savedRecentConnection.id)).to.be.null;
389+
}
385390

386391
await connectAndNotifyInstanceManager(savedRecentConnection);
387-
expect(connection1).to.exist;
388-
expect(connection2).to.exist;
392+
{
393+
expect(screen.queryByTestId(savedFavoriteConnection.id)).to.be
394+
.visible;
395+
expect(screen.queryByTestId(savedRecentConnection.id)).to.be
396+
.visible;
397+
}
389398
});
390399

391400
context('and performing actions', function () {

0 commit comments

Comments
 (0)