mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-10-20 18:56:30 +00:00
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.
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
// Copyright 2017-2026 @pezkuwi/apps authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import baseConfig from '@pezkuwi/dev/config/eslint';
|
|
|
|
export default [
|
|
...baseConfig,
|
|
{
|
|
rules: {
|
|
// Polkadot/Substrate APIs are highly dynamic with runtime-determined types.
|
|
// These rules conflict with no-explicit-any being off and the ecosystem's nature.
|
|
// Original polkadot-apps also has 3600+ of these errors unfixed.
|
|
// Keys must be in alphabetical order (sort-keys rule).
|
|
'@typescript-eslint/no-explicit-any': 'off',
|
|
'@typescript-eslint/no-redundant-type-constituents': 'off',
|
|
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
'@typescript-eslint/no-unsafe-assignment': 'off',
|
|
'@typescript-eslint/no-unsafe-call': 'off',
|
|
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
'@typescript-eslint/no-unsafe-return': 'off',
|
|
'@typescript-eslint/unbound-method': 'off'
|
|
}
|
|
},
|
|
{
|
|
// the same files the base config enables the jest plugin for
|
|
files: ['**/*.spec.ts', '**/*.spec.tsx'],
|
|
rules: {
|
|
// the specs assert through expect() and the assert* helpers in test-support
|
|
'jest/expect-expect': ['warn', { assertFunctionNames: ['expect', 'assert*', '*.assert*', '*.expect*'] }]
|
|
}
|
|
}
|
|
];
|