From 708e7fabcae3645e551019fc61a00c99c0bc0fcd Mon Sep 17 00:00:00 2001 From: Erik Moura Date: Tue, 16 Jan 2024 22:53:04 -0300 Subject: [PATCH] test: check for button text instead of function argument --- rtl-spec/components/commands-version-chooser.spec.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rtl-spec/components/commands-version-chooser.spec.tsx b/rtl-spec/components/commands-version-chooser.spec.tsx index 87a5be3270..064ec7a415 100644 --- a/rtl-spec/components/commands-version-chooser.spec.tsx +++ b/rtl-spec/components/commands-version-chooser.spec.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; -import { render, screen } from '@testing-library/react'; +import { render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { VersionChooser } from '../../src/renderer/components/commands-version-chooser'; @@ -28,6 +28,10 @@ describe('VersionSelect component', () => { await userEvent.click(versionButton); - expect(appState.setVersion).toHaveBeenCalledWith(mockVersion1.version); + waitFor(() => + expect(btnOpenVersionSelector.textContent).toContain( + mockVersion1.version, + ), + ); }); });