Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed Dec 4, 2023
1 parent a57db1b commit b275f9f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
24 changes: 23 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,30 @@ jobs:
name: web-app-client
path: telematic_system/telematic_apps/web_app/client/coverage/*
if-no-files-found: error
web_app_server_coverage:
runs-on: ubuntu-latest
container:
image: node:16.16.0
options: --user root
env:
CI: true
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v3
- name: Build
run: |
cd $GITHUB_WORKSPACE/telematic_system/telematic_apps/web_app/server
npm init -y
npm install --force
npm test -- --coverage || true
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: web-app-server
path: telematic_system/telematic_apps/web_app/server/coverage/*
if-no-files-found: error
sonar:
needs: [carma_vehicle_bridge_coverage, carma_cloud_bridge_coverage, telematic_cloud_messaging_coverage, web_app_client_coverage]
needs: [carma_vehicle_bridge_coverage, carma_cloud_bridge_coverage, telematic_cloud_messaging_coverage, web_app_client_coverage, web_app_server_coverage]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.event.repository.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Grafana = () => {
width="100%"
height="100%"
frameBorder="0"
allowFullScreen />
allowFullscreen />
</Grid>

</React.Fragment>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { afterEach, jest, test } from '@jest/globals'
import { fireEvent, render, screen } from '@testing-library/react'
import { test } from '@jest/globals'
import { render, screen } from '@testing-library/react'
import { act } from 'react-dom/test-utils'
import { BrowserRouter } from 'react-router-dom'
import Grafana from '../../pages/Grafana'

test('Forgot password page', async () => {
test('Grafana page', async () => {
await act(async () => {
render(<Grafana />)
render(
<BrowserRouter>
<Grafana />
</BrowserRouter>)
})

await act(async () => {
// fireEvent.load()
});
expect(screen.getByRole('progressbar')).toBeInTheDocument();
})

0 comments on commit b275f9f

Please sign in to comment.