Files
Genarrative/src/components/platform-entry/usePlatformProfileCenterController.walletLedger.test.tsx
T
k88936 fc0dcb0782
Project CI / Repository checks (push) Successful in 50s
Project CI / Frontend tests (push) Has been cancelled
Project CI / Backend tests (push) Has been cancelled
Project CI / Native shell tests (push) Has been cancelled
修复泥点消耗刷新不及时 (#138)
refactor:
- 主站复用game agent的zustand store

fix:
- 修复旧请求覆盖问题
- 修复账号切换问题

- 主站原本已经每 4 秒轮询 external generation 任务状态, 在这里补充触发余额刷新的时机

---------

Co-authored-by: 段舒康 <kdletters@qq.com>
Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/138
Co-authored-by: 王德宇 <kvtodev@outlook.com>
Co-committed-by: 王德宇 <kvtodev@outlook.com>
2026-08-08 10:25:02 +08:00

34 lines
1.0 KiB
TypeScript

/* @vitest-environment jsdom */
import { act, waitFor } from '@testing-library/react';
import { beforeEach, describe, expect, test, vi } from 'vitest';
import { usePlatformWalletStore } from '../../stores/usePlatformWalletStore';
import {
profileClientMocks,
renderController,
userA,
} from './usePlatformProfileCenterController.testSupport';
describe('usePlatformProfileCenterController wallet ledger', () => {
beforeEach(() => {
window.history.replaceState(null, '', '/profile');
usePlatformWalletStore.getState().resetWalletBalance();
vi.clearAllMocks();
});
test('settles a valid read without depending on wallet-store owner initialization', async () => {
profileClientMocks.getPlatformProfileWalletLedger.mockResolvedValue({
entries: [],
});
const { result } = renderController(userA);
act(() => result.current.loadWalletLedger());
await waitFor(() => {
expect(result.current.walletLedger).toEqual({ entries: [] });
expect(result.current.isLoadingWalletLedger).toBe(false);
});
});
});