mirror of
https://github.com/rive-app/rive-react.git
synced 2026-03-13 08:22:30 +08:00
test: update useRiveFile tests to check buffer changes
This commit is contained in:
@@ -44,7 +44,7 @@ describe('useRiveFile', () => {
|
||||
expect(riveInstance?.cleanup).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not reinitialize RiveFile if params do not change', async () => {
|
||||
it('does not reinitialize RiveFile if src has not changed', async () => {
|
||||
const params = {
|
||||
src: 'file-src',
|
||||
enableRiveAssetCDN: false
|
||||
@@ -57,6 +57,19 @@ describe('useRiveFile', () => {
|
||||
expect(RiveFile).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('does not reinitialize RiveFile if buffer has not changed', async () => {
|
||||
const params = {
|
||||
buffer: new ArrayBuffer(10),
|
||||
enableRiveAssetCDN: false
|
||||
};
|
||||
|
||||
const { rerender } = renderHook(() => useRiveFile(params));
|
||||
|
||||
rerender();
|
||||
|
||||
expect(RiveFile).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('reinitializes RiveFile if src changes', async () => {
|
||||
let params = {
|
||||
src: 'file-src',
|
||||
|
||||
Reference in New Issue
Block a user