From 02500b54231818090d59163e09ab6be303a61f4a Mon Sep 17 00:00:00 2001 From: Calvin Yau Date: Tue, 29 Oct 2024 19:25:51 -0700 Subject: [PATCH] test: modify tests for changes --- .../OtherCI/OtherCI.test.tsx | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/pages/RepoPage/CoverageOnboarding/OtherCI/OtherCI.test.tsx b/src/pages/RepoPage/CoverageOnboarding/OtherCI/OtherCI.test.tsx index ebda26b116..225d1433b7 100644 --- a/src/pages/RepoPage/CoverageOnboarding/OtherCI/OtherCI.test.tsx +++ b/src/pages/RepoPage/CoverageOnboarding/OtherCI/OtherCI.test.tsx @@ -146,7 +146,7 @@ describe('OtherCI', () => { expect(codecovToken).toBeInTheDocument() const tokenValue = await screen.findAllByText(/repo-token-jkl;-7890/) - expect(tokenValue).toHaveLength(2) + expect(tokenValue).toHaveLength(1) }) }) }) @@ -200,6 +200,10 @@ describe('OtherCI', () => { const box = await screen.findByText(/upload-process/) expect(box).toBeInTheDocument() + const instruction = await screen.findByText( + /If you are using a repo token/ + ) + expect(instruction).toBeInTheDocument() }) describe('when org has upload token', () => { @@ -210,6 +214,18 @@ describe('OtherCI', () => { const box = await screen.findByText(/-r cool-repo/) expect(box).toBeInTheDocument() }) + + it('renders both command boxes', async () => { + setup({ hasOrgUploadToken: true }) + render(, { wrapper }) + + const commandBoxes = await screen.findAllByText(/upload-process/) + expect(commandBoxes).toHaveLength(2) + const instruction = await screen.findByText( + /If you are using an org token/ + ) + expect(instruction).toBeInTheDocument() + }) }) describe('when org does not have org upload token', () => { @@ -219,6 +235,8 @@ describe('OtherCI', () => { const box = screen.queryByText(/-r cool-repo/) expect(box).not.toBeInTheDocument() + const instruction = screen.queryByText(/If you are using an org token/) + expect(instruction).not.toBeInTheDocument() }) })