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:
2026-01-18 03:30:47 +03:00
parent 40bc15f1f9
commit 1daafc75ca
+5 -5
View File
@@ -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', () => ({