mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 05:37:56 +00:00
Fix Jest mocks for CI: add virtual: true for optional packages
@polkadot/api and @pezkuwi/* packages are not installed in CI, so jest.mock needs virtual: true to allow mocking without the actual module being present. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -104,7 +104,7 @@ jest.mock('@react-native-async-storage/async-storage', () =>
|
||||
require('@react-native-async-storage/async-storage/jest/async-storage-mock')
|
||||
);
|
||||
|
||||
// Mock Polkadot.js
|
||||
// Mock Polkadot.js (virtual: true because package may not be installed in CI)
|
||||
jest.mock('@polkadot/api', () => ({
|
||||
ApiPromise: {
|
||||
create: jest.fn(() =>
|
||||
@@ -118,7 +118,7 @@ jest.mock('@polkadot/api', () => ({
|
||||
),
|
||||
},
|
||||
WsProvider: jest.fn(),
|
||||
}));
|
||||
}), { virtual: true });
|
||||
|
||||
// Mock @pezkuwi packages (aliases for @polkadot packages)
|
||||
jest.mock('@pezkuwi/api', () => ({
|
||||
@@ -150,7 +150,7 @@ jest.mock('@pezkuwi/api', () => ({
|
||||
),
|
||||
},
|
||||
WsProvider: jest.fn(),
|
||||
}));
|
||||
}), { virtual: true });
|
||||
|
||||
jest.mock('@pezkuwi/keyring', () => ({
|
||||
Keyring: jest.fn().mockImplementation(() => ({
|
||||
@@ -180,13 +180,13 @@ jest.mock('@pezkuwi/keyring', () => ({
|
||||
verify: jest.fn(),
|
||||
})),
|
||||
})),
|
||||
}));
|
||||
}), { virtual: true });
|
||||
|
||||
jest.mock('@pezkuwi/util-crypto', () => ({
|
||||
cryptoWaitReady: jest.fn(() => Promise.resolve(true)),
|
||||
mnemonicGenerate: jest.fn(() => 'test test test test test test test test test test test junk'),
|
||||
mnemonicValidate: jest.fn(() => true),
|
||||
}));
|
||||
}), { virtual: true });
|
||||
|
||||
// Mock Supabase
|
||||
jest.mock('./src/lib/supabase', () => ({
|
||||
|
||||
Reference in New Issue
Block a user