diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e4bb680..0108097 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,4 +45,9 @@ jobs: - run: npm --prefix gatewayservice install - run: npm --prefix webapp install - run: npm --prefix webapp run build - - run: npm --prefix webapp run test:e2e \ No newline at end of file + - run: npm --prefix webapp run test:e2e + - name: Analyze with SonarCloud + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file diff --git a/webapp/src/components/fragments/NavBar.test.js b/webapp/src/components/fragments/NavBar.test.js index 7fe0137..6c29703 100644 --- a/webapp/src/components/fragments/NavBar.test.js +++ b/webapp/src/components/fragments/NavBar.test.js @@ -18,12 +18,15 @@ Cookies.set('user', JSON.stringify({ username: 'dummy' })) describe('NavBar fragment', () => { - it('shows the user name',async () => { + it('shows the user name and can log out',async () => { render(); const text2 = await screen.findByText('dummy') expect(text2).toBeInTheDocument(); - // Wait for questions to load + fireEvent.click(screen.getByText('dummy')); + expect(screen.getByText('navBar.logout')).toBeInTheDocument(); + fireEvent.click(screen.getByText('navBar.logout')); + expect(screen.queryByText('dummy')).not.toBeInTheDocument(); }); test('Navbar renders correctly', async () => {