Skip to content

Commit f86129c

Browse files
Copilotmorganney
andcommitted
Fix TypeScript lint error in render prop test by replacing expect.any with type checking
Co-authored-by: morganney <848178+morganney@users.noreply.github.com>
1 parent 574f508 commit f86129c

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/tts-react/__tests__/hook.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,17 @@ describe('useTts', () => {
370370
)
371371

372372
expect(result.current.spokenText).toBe(testText)
373-
expect(mockRender).toHaveBeenCalledWith({
374-
children: testText,
375-
boundary: expect.any(Object),
376-
markTextAsSpoken: true,
377-
markColor: undefined,
378-
markBackgroundColor: undefined
379-
})
373+
expect(mockRender).toHaveBeenCalledTimes(1)
374+
const callArgs = mockRender.mock.calls[0][0]
375+
expect(callArgs.children).toBe(testText)
376+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
377+
expect(typeof callArgs.boundary.word).toBe('string')
378+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
379+
expect(typeof callArgs.boundary.startChar).toBe('number')
380+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
381+
expect(typeof callArgs.boundary.endChar).toBe('number')
382+
expect(callArgs.markTextAsSpoken).toBe(true)
383+
expect(callArgs.markColor).toBeUndefined()
384+
expect(callArgs.markBackgroundColor).toBeUndefined()
380385
})
381386
})

0 commit comments

Comments
 (0)