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">
|
||||
<FileListing />
|
||||
</Box>
|
||||
{localStorage.__dev_test === '1' && <WasmTest />}
|
||||
<WasmTest />
|
||||
<Footer />
|
||||
</Container>
|
||||
</Box>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { loadLibParakeet, BlobSink, createArrayBufferReader } from '@jixun/libparakeet';
|
||||
|
||||
/* c8 ignore start: test only code */
|
||||
function testWasm() {
|
||||
loadLibParakeet().then(async (mod) => {
|
||||
const data = new Uint8Array(0x2000);
|
||||
@ -23,9 +24,15 @@ function testWasm() {
|
||||
}
|
||||
|
||||
export function WasmTest() {
|
||||
// Some secret test flags...
|
||||
if (localStorage.__dev_test !== '1') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<button onClick={testWasm} type="button">
|
||||
Test WASM
|
||||
</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', () => {
|
||||
render(<div>hello</div>);
|
||||
expect(screen.getByText('hello')).toBeInTheDocument();
|
||||
test('should be able to render App', () => {
|
||||
renderWithProviders(<App />);
|
||||
|
||||
// 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