From ab0ddd04b5779baf59e269e7250d8f67921df7fd Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 23 Jun 2021 15:12:07 -0500 Subject: [PATCH] about/AboutDialog: fix failing test when $REACT_APP_NAME set When the `REACT_APP_NAME` environment variable is set to something other that "Pybricks Code", it caused the test to fail. --- src/about/AboutDialog.test.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/about/AboutDialog.test.tsx b/src/about/AboutDialog.test.tsx index e4c638d2..e1c6e169 100644 --- a/src/about/AboutDialog.test.tsx +++ b/src/about/AboutDialog.test.tsx @@ -53,9 +53,12 @@ it('should manage license dialog open/close', async () => { userEvent.click(screen.getByText('Software Licenses')); expect( - screen.getByText('Pybricks Code is built on open source software.', { - exact: false, - }), + screen.getByText( + `${process.env.REACT_APP_NAME} is built on open source software.`, + { + exact: false, + }, + ), ).toBeInTheDocument(); const licenseDialog = document.querySelector( @@ -64,8 +67,11 @@ it('should manage license dialog open/close', async () => { userEvent.click(getByLabelText(licenseDialog, 'Close')); await waitForElementToBeRemoved(() => - screen.queryByText('Pybricks Code is built on open source software.', { - exact: false, - }), + screen.queryByText( + `${process.env.REACT_APP_NAME} is built on open source software.`, + { + exact: false, + }, + ), ); });