test(ci): align strict community mocks

This commit is contained in:
Tommaso Casaburi
2026-04-15 13:18:02 +07:00
parent e5aed2c7db
commit 45567013fc
9 changed files with 372 additions and 97 deletions
+4 -1
View File
@@ -48,7 +48,10 @@ const testState = vi.hoisted(() => ({
vi.mock('@bitsocialnet/bitsocial-react-hooks', () => ({
useAccount: () => testState.account,
useAccountComment: ({ commentIndex }: { commentIndex?: number }) => (typeof commentIndex === 'number' ? testState.accountComments[commentIndex] : undefined),
useCommunity: ({ communityAddress }: { communityAddress?: string }) => (communityAddress ? testState.subplebbits[communityAddress] : undefined),
useCommunity: (options?: { communityAddress?: string; community?: { name?: string; publicKey?: string } }) => {
const communityAddress = options?.communityAddress ?? options?.community?.name ?? options?.community?.publicKey;
return communityAddress ? testState.subplebbits[communityAddress] : undefined;
},
useAccountCommunities: () => ({
accountCommunities: Object.fromEntries(testState.accountSubplebbitAddresses.map((address) => [address, { address }])),
}),