fc0dcb0782
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>
34 lines
1.0 KiB
TypeScript
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);
|
|
});
|
|
});
|
|
});
|