test: fix assign error

This commit is contained in:
CI
2025-08-11 19:46:06 +02:00
parent a958bdaa72
commit 76fe777fb1

View File

@@ -1,4 +1,3 @@
import { mocked } from 'jest-mock';
import { renderHook } from '@testing-library/react';
import useStateMachineInput from '../src/hooks/useStateMachineInput';
@@ -35,6 +34,7 @@ function getRiveMock({
const riveMock = new Rive({
canvas: undefined as unknown as HTMLCanvasElement,
});
if (smiInputs) {
riveMock.stateMachineInputs = jest.fn().mockReturnValue(smiInputs);
}
@@ -51,8 +51,6 @@ describe('useStateMachineInput', () => {
it('returns null if there is no state machine name', () => {
const riveMock = getRiveMock();
mocked(Rive).mockImplementation(() => riveMock);
const { result } = renderHook(() =>
useStateMachineInput(riveMock, '', 'testInput')
);
@@ -71,10 +69,8 @@ describe('useStateMachineInput', () => {
it('returns null if there are no inputs for the state machine', () => {
const riveMock = getRiveMock({ smiInputs: [] });
mocked(Rive).mockImplementation(() => riveMock);
const { result } = renderHook(() =>
useStateMachineInput(riveMock as Rive, 'smName', '')
useStateMachineInput(riveMock, 'smName', '')
);
expect(result.current).toBeNull();
});
@@ -85,8 +81,6 @@ describe('useStateMachineInput', () => {
} as StateMachineInput;
const riveMock = getRiveMock({ smiInputs: [smInput] });
mocked(Rive).mockImplementation(() => riveMock);
const { result } = renderHook(() =>
useStateMachineInput(riveMock, 'smName', 'numInput')
);
@@ -99,8 +93,6 @@ describe('useStateMachineInput', () => {
} as StateMachineInput;
const riveMock = getRiveMock({ smiInputs: [smInput] });
mocked(Rive).mockImplementation(() => riveMock);
const { result } = renderHook(() =>
useStateMachineInput(riveMock, 'smName', 'boolInput')
);
@@ -113,7 +105,6 @@ describe('useStateMachineInput', () => {
value: false,
} as StateMachineInput;
const riveMock = getRiveMock({ smiInputs: [smInput] });
mocked(Rive).mockImplementation(() => riveMock);
const { result } = renderHook(() =>
useStateMachineInput(riveMock, 'smName', 'boolInput', true)