Compare commits

...

3 Commits

Author SHA1 Message Date
CI
3af6b41f17 chore: testing if it just needs types/node 2025-08-11 20:13:49 +02:00
CI
76fe777fb1 test: fix assign error 2025-08-11 19:46:06 +02:00
CI
a958bdaa72 docs: update readme 2025-08-11 19:26:22 +02:00
3 changed files with 10 additions and 13 deletions

View File

@@ -6,9 +6,14 @@
![Rive hero image](https://cdn.rive.app/rive_logo_dark_bg.png)
A React runtime library for [Rive](https://rive.app).
[Rive](https://rive.app) combines an interactive design tool, a new stateful graphics format, a lightweight multi-platform runtime, and a blazing-fast vector renderer. This end-to-end pipeline guarantees that what you build in the Rive Editor is exactly what ships in your apps, games, and websites.
This library is a wrapper around the [JS/Wasm runtime](https://github.com/rive-app/rive-wasm), giving full control over the js runtime while providing components and hooks for React applications.
For more information, check out the following resources:
- [Homepage](https://rive.app/)
- [General Docs](https://rive.app/docs/)
- [React Docs](https://rive.app/docs/runtimes/react/react)
- [Rive Community / Support](https://community.rive.app/c/support/)
## Table of contents

View File

@@ -48,6 +48,7 @@
"@testing-library/jest-dom": "^5.13.0",
"@testing-library/react": "^16.3.0",
"@types/jest": "^27.0.3",
"@types/node": "^18.17.0",
"@types/offscreencanvas": "^2019.6.4",
"@types/react": "^18.0.0",
"@types/testing-library__jest-dom": "^5.9.5",

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)