Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 2 additions & 11 deletions test/useStateMachine.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { mocked } from 'jest-mock';
import { renderHook } from '@testing-library/react';

import useStateMachineInput from '../src/hooks/useStateMachineInput';
Expand Down Expand Up @@ -35,6 +34,7 @@ function getRiveMock({
const riveMock = new Rive({
canvas: undefined as unknown as HTMLCanvasElement,
});

if (smiInputs) {
riveMock.stateMachineInputs = jest.fn().mockReturnValue(smiInputs);
}
Expand All @@ -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')
);
Expand All @@ -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();
});
Expand All @@ -85,8 +81,6 @@ describe('useStateMachineInput', () => {
} as StateMachineInput;
const riveMock = getRiveMock({ smiInputs: [smInput] });

mocked(Rive).mockImplementation(() => riveMock);

const { result } = renderHook(() =>
useStateMachineInput(riveMock, 'smName', 'numInput')
);
Expand All @@ -99,8 +93,6 @@ describe('useStateMachineInput', () => {
} as StateMachineInput;
const riveMock = getRiveMock({ smiInputs: [smInput] });

mocked(Rive).mockImplementation(() => riveMock);

const { result } = renderHook(() =>
useStateMachineInput(riveMock, 'smName', 'boolInput')
);
Expand All @@ -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)
Expand Down