Skip to content

Commit

Permalink
Merge pull request #8255 from LedgerHQ/fix/polkadot-tests-timeout
Browse files Browse the repository at this point in the history
Fix/polkadot tests timeout
  • Loading branch information
qperrot authored Oct 31, 2024
2 parents fc12a76 + 1f8c126 commit 308da49
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-ads-retire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ledgerhq/coin-polkadot": patch
---

Fix tests with mock
22 changes: 15 additions & 7 deletions libs/coin-modules/coin-polkadot/src/bridge/signOperation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,21 @@ const mockPaymentInfo = jest.fn().mockResolvedValue({
class: "WHATEVER",
partialFee: "155099814",
});

jest.mock("../network", () => ({
...jest.requireActual("../network").default,
metadataHash: () => jest.fn().mockResolvedValue(""),
shortenMetadata: () => jest.fn().mockResolvedValue(""),
}));
jest.mock("../network/sidecar", () => ({
getRegistry: () => mockRegistry(),
paymentInfo: (args: any) => mockPaymentInfo(args),
getTransactionParams: () => mockTransactionParams(),
fetchTransactionMaterial: () => fixtureTxMaterialWithMetadata,
}));

describe("signOperation", () => {
// Global setup
jest.setTimeout(20000);
jest.mock("../network/sidecar", () => ({
getRegistry: () => mockRegistry(),
paymentInfo: (args: any) => mockPaymentInfo(args),
getTransactionParams: () => mockTransactionParams(),
fetchTransactionMaterial: () => fixtureTxMaterialWithMetadata,
}));
const fakeSignature = u8aConcat(new Uint8Array([1]), new Uint8Array(64).fill(0x42));
const fakeSigner = {
getAddress: jest.fn(),
Expand All @@ -45,6 +51,7 @@ describe("signOperation", () => {
fn(fakeSigner);
const signOperation = buildSignOperation(signerContext);
const deviceId = "dummyDeviceId";

beforeAll(() => {
mockGetConfig.mockImplementation((): any => {
return {
Expand All @@ -67,6 +74,7 @@ describe("signOperation", () => {
};
});
});

it("returns events in the right order", done => {
// GIVEN
const account = createFixtureAccount();
Expand Down

0 comments on commit 308da49

Please sign in to comment.