diff --git a/src/pages/index/+Page.jsx b/src/pages/index/+Page.jsx index c02e311..2e7fd24 100644 --- a/src/pages/index/+Page.jsx +++ b/src/pages/index/+Page.jsx @@ -5,7 +5,6 @@ import fastbootPorts from '../../assets/fastboot-ports.svg' import zadigCreateNewDevice from '../../assets/zadig_create_new_device.png' import zadigForm from '../../assets/zadig_form.png' - export default function App() { const version = import.meta?.env?.VITE_PUBLIC_GIT_SHA ?? 'dev' console.info(`flash.comma.ai version: ${version}`) diff --git a/src/pages/index/Page.test.jsx b/src/pages/index/Page.test.jsx index 206de72..13095c3 100644 --- a/src/pages/index/Page.test.jsx +++ b/src/pages/index/Page.test.jsx @@ -1,10 +1,9 @@ import { Suspense } from 'react' import { expect, test } from 'vitest' import { render, screen } from '@testing-library/react' - -import App from '.' +import Page from './+Page' test('renders without crashing', () => { - render() + render() expect(screen.getByText('flash.comma.ai')).toBeInTheDocument() }) diff --git a/src/test/mockWorker.js b/src/test/mockWorker.js new file mode 100644 index 0000000..26bd9ea --- /dev/null +++ b/src/test/mockWorker.js @@ -0,0 +1,16 @@ +class MockWorker { + constructor(stringUrl) { + this.url = stringUrl; + this.onmessage = () => {}; + } + + postMessage(msg) { + this.onmessage({ data: msg }); + } + + addEventListener() {} + removeEventListener() {} + terminate() {} +} + +export default MockWorker; diff --git a/src/test/setup.js b/src/test/setup.js index c44951a..82b22f0 100644 --- a/src/test/setup.js +++ b/src/test/setup.js @@ -1 +1,4 @@ import '@testing-library/jest-dom' +import MockWorker from './mockWorker'; + +global.Worker = MockWorker