mirror of
https://git.unlock-music.dev/um/um-react.git
synced 2024-11-23 22:42:16 +00:00
test: proper sanity check; exclude WasmTest from coverage (#8)
This commit is contained in:
parent
0b7b72c8ef
commit
fd410302e4
@ -15,7 +15,7 @@ function App() {
|
|||||||
<Box mt="8">
|
<Box mt="8">
|
||||||
<FileListing />
|
<FileListing />
|
||||||
</Box>
|
</Box>
|
||||||
{localStorage.__dev_test === '1' && <WasmTest />}
|
<WasmTest />
|
||||||
<Footer />
|
<Footer />
|
||||||
</Container>
|
</Container>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { loadLibParakeet, BlobSink, createArrayBufferReader } from '@jixun/libparakeet';
|
import { loadLibParakeet, BlobSink, createArrayBufferReader } from '@jixun/libparakeet';
|
||||||
|
|
||||||
|
/* c8 ignore start: test only code */
|
||||||
function testWasm() {
|
function testWasm() {
|
||||||
loadLibParakeet().then(async (mod) => {
|
loadLibParakeet().then(async (mod) => {
|
||||||
const data = new Uint8Array(0x2000);
|
const data = new Uint8Array(0x2000);
|
||||||
@ -23,9 +24,15 @@ function testWasm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function WasmTest() {
|
export function WasmTest() {
|
||||||
|
// Some secret test flags...
|
||||||
|
if (localStorage.__dev_test !== '1') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button onClick={testWasm} type="button">
|
<button onClick={testWasm} type="button">
|
||||||
Test WASM
|
Test WASM
|
||||||
</button>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/* c8 ignore stop: test only code */
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import App from '~/App';
|
||||||
|
import { renderWithProviders, screen } from '~/test-utils/test-helper';
|
||||||
|
|
||||||
test('hello', () => {
|
test('should be able to render App', () => {
|
||||||
render(<div>hello</div>);
|
renderWithProviders(<App />);
|
||||||
expect(screen.getByText('hello')).toBeInTheDocument();
|
|
||||||
|
// Quick sanity check of known strings.
|
||||||
|
expect(screen.getByText(/仅在浏览器内对文件进行解锁/i)).toBeInTheDocument();
|
||||||
|
expect(screen.getByText(/UnlockMusic 团队/i)).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user