feat: 前端改为通过签名地址读取生成资源

This commit is contained in:
2026-04-21 16:45:05 +08:00
parent fcaf7bdb38
commit 78dcad1222
26 changed files with 779 additions and 76 deletions

View File

@@ -1,11 +1,19 @@
// @vitest-environment jsdom
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { AnimationState, type Character } from '../types';
import { CharacterAnimator } from './CharacterAnimator';
vi.mock('../hooks/useResolvedAssetReadUrl', () => ({
useResolvedAssetReadUrl: vi.fn((source: string | null | undefined) => ({
resolvedUrl: source?.trim() ?? '',
isResolving: false,
shouldResolve: false,
})),
}));
function buildCharacter(overrides: Partial<Character> = {}): Character {
return {
id: 'generated-role',
@@ -26,6 +34,10 @@ function buildCharacter(overrides: Partial<Character> = {}): Character {
}
describe('CharacterAnimator portrait fallbacks', () => {
beforeEach(() => {
vi.clearAllMocks();
});
it('keeps idle fallback static on the portrait when idle animation is missing', () => {
render(
<CharacterAnimator