test(mobile): keep the toolbar test inside the tests-typecheck ratchet

`check-tests-typecheck-ratchet.mjs` reported the new file as newly failing
`tsc -p tsconfig.test.json`: the `ScrollView` mock's spread did not match any
`createElement` overload, and comparing a node's `ElementType` against the string
`'Pressable'` is a no-overlap comparison. Host strings for the mock and
`String(node.type)` for the read, rather than a cast. Ratchet back to OK at 800
files.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
This commit is contained in:
Jinwoo-H
2026-09-21 17:57:32 -04:00
parent 7751b83a9f
commit 7cc183de83
@@ -2,16 +2,12 @@ import { createElement } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, describe, expect, it, vi } from 'vitest'
vi.mock('react-native', async () => {
const React = await import('react')
return {
Pressable: 'Pressable',
ScrollView: ({ children, ...props }: { children?: unknown }) =>
React.createElement('ScrollView', props, children),
StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 },
View: 'View'
}
})
vi.mock('react-native', () => ({
Pressable: 'Pressable',
ScrollView: 'ScrollView',
StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 },
View: 'View'
}))
vi.mock('lucide-react-native', () => ({
Bold: 'Bold',
@@ -75,7 +71,7 @@ function render(editable: boolean, onCommand: (command: MobileRichMarkdownComman
act(() => {
renderer = create(createElement(MobileRichMarkdownToolbar, { editable, onCommand }))
})
return renderer!.root.findAll((node) => node.type === 'Pressable')
return renderer!.root.findAll((node) => String(node.type) === 'Pressable')
}
describe('the rich Markdown toolbar', () => {