Skip to content

Commit 58c782d

Browse files
committed
refactor(tests): remove last @ts-ignore directives from test files
Zero \`@ts-ignore\` / \`@ts-expect-error\` suppressions remain under src/**/*.test.*. - getResizedImageUrl.test.ts: typed the mocked URL object as \`as unknown as URL\` at the return value instead of silencing the search-params shape mismatch inline. - renderText.test.tsx: - Dropped \`@ts-ignore\` on the \`simple-markdown\` import (\`ASTNode\`/\`SingleASTNode\` are declared in the bundled \`simple-markdown.d.ts\` — the ignore was stale). - Replaced \`<Text>{node}</Text>\` with \`<Text>{JSON.stringify(node)}</Text>\` so the \`ASTNode\` value is a valid React child; the test only asserts \`getByText\`, the content shape is incidental.
1 parent 1e54631 commit 58c782d

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

package/src/components/Message/MessageItemView/utils/renderText.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import type { ReactTestInstance } from 'react-test-renderer';
55

66
import { render, waitFor, within } from '@testing-library/react-native';
77

8-
// @ts-ignore
9-
import { ASTNode, SingleASTNode } from 'simple-markdown';
8+
import type { ASTNode, SingleASTNode } from 'simple-markdown';
109

1110
import { ListOutput, ListOutputProps } from './renderText';
1211

@@ -26,8 +25,7 @@ describe('list', () => {
2625
type: 'text',
2726
});
2827

29-
// @ts-ignore
30-
const mockOutput = (node: ASTNode) => <Text>{node}</Text>;
28+
const mockOutput = (node: ASTNode) => <Text>{JSON.stringify(node)}</Text>;
3129
const MockText = ({ node, output, state }: ListOutputProps) => (
3230
<>
3331
<ListOutput node={node} output={output} state={state} styles={{}} />

package/src/utils/__tests__/getResizedImageUrl.test.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,16 @@ describe('getResizedImageUrl (sad flow)', () => {
6161
it('handles an error correctly and log warns it', () => {
6262
let someError;
6363
jest.spyOn(console, 'warn');
64-
jest.spyOn(global, 'URL').mockImplementationOnce(() => ({
65-
// @ts-ignore
66-
searchParams: {
67-
get: () => {
68-
throw (someError = new Error('some error'));
69-
},
70-
},
71-
}));
64+
jest.spyOn(global, 'URL').mockImplementationOnce(
65+
() =>
66+
({
67+
searchParams: {
68+
get: () => {
69+
throw (someError = new Error('some error'));
70+
},
71+
},
72+
}) as unknown as URL,
73+
);
7274
const resizedUrl = getResizedImageUrl({
7375
url: TEST_URL_1,
7476
});

0 commit comments

Comments
 (0)