Integration specs: node:test module mocks instead of jest.mock

The account, address, sidebar and bounties specs replaced hooks with
jest.mock, which the node:test runner does not have, so all five failed
to load and were excluded from yarn test. They now register mocks with
mock.module from node:test and import the page under test afterwards,
since Node only swaps a module that has not been loaded yet.

- test-support/mocks: mockPageHooks() replaces the hooks a Page reads.
  An ES module mock replaces every export, so each mock lists them all
  (useBestNumber's useBestNumberRelay included). The real useAccountInfo
  is wrapped, typed now, with the fixture identity merged in a typed
  helper.
- The page-specific mocks live with their page: useMultisigApprovals in
  page-accounts/test, useAddresses in page-addresses/test.
- jest-dom matchers were never registered for this runner; specs and
  page elements use assertHasClass, assertTextContent and assertVisible
  from test-support, with the same meaning.
- Page's mock api gains apiIdentity, which useAccountInfo reads.
- The bounties voting tooltip renders hidden and fades in, so the spec
  waits for it to become visible.
- jest/expect-expect counts the assert* helpers as assertions; the
  disable comments that only existed for that are removed.

Create and Bounties run green. Accounts, Addresses and Sidebar load and
stay skipped as upstream left them (their FIXMEs are about the reworked
tables). Needs @pezkuwi/dev 0.86.6 for the module mocks flag and the
fuller browser env.
This commit is contained in:
Satoshi Qazi Muhammed authored and SatoshiQaziMuhammed committed 2026-10-10 11:42:13 +04:00
1 parent 8539e30888
commit 0c5b47ce0e
20 files changed
+330 -192

No files matched your search

@@ -5,6 +5,7 @@
import { fireEvent, screen, within } from '@testing-library/react';
import { assertTextContent } from '../utils/domAssertions.js';
import { JudgementTag } from './JudgementTag.js';
export class Sidebar {
@@ -48,19 +49,19 @@ export class Sidebar {
const sideBarAddressSection = await this.findByTestId('sidebar-address-menu');
const sideBarName = await within(sideBarAddressSection).findByTestId('account-name');
expect(sideBarName).toHaveTextContent(expectedAccountName);
assertTextContent(sideBarName, expectedAccountName);
}
async assertJudgement (judgement: string): Promise<void> {
const judgementsSection = await this.findByTestId('judgements');
expect(judgementsSection).toHaveTextContent(judgement);
assertTextContent(judgementsSection, judgement);
}
async assertTags (tagsContent: string): Promise<void> {
const sideBarTags = await this.findByTestId('sidebar-tags');
expect(sideBarTags).toHaveTextContent(tagsContent);
assertTextContent(sideBarTags, tagsContent);
}
close (): Promise<void> {