Skip to content

Commit

Permalink
fix(core-test-framework): use hapi inject when creating transfer tran…
Browse files Browse the repository at this point in the history
…saction (#3774)
  • Loading branch information
rainydio authored Jun 4, 2020
1 parent 6f9887f commit 3ac7a03
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
5 changes: 2 additions & 3 deletions __tests__/unit/core-test-framework/utils/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "jest-extended";
import { Sandbox } from "@packages/core-test-framework";
import { Identifiers } from "@packages/core-api";
import { ApiHelpers } from "@packages/core-test-framework/src/utils/api";
import { Utils } from "@packages/core-kernel";
import {
blockResponse,
delegateResponse,
Expand Down Expand Up @@ -177,7 +176,7 @@ describe("ApiHelpers", () => {
describe("createTransfer", () => {
it("should create transfer transaction", async () => {
// @ts-ignore
let spyOnPost = jest.spyOn(Utils.http, "post").mockImplementation(async (url: any, opts: any) => {});
let spyOnRequest = jest.spyOn(api, "request");

let transaction = await api.createTransfer();

Expand All @@ -192,7 +191,7 @@ describe("ApiHelpers", () => {
expect(transaction.nonce).toBeDefined();
expect(transaction.recipientId).toBeDefined();

expect(spyOnPost).toHaveBeenCalled();
expect(spyOnRequest).toHaveBeenCalled();
});
});
});
9 changes: 1 addition & 8 deletions packages/core-test-framework/src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,7 @@ export class ApiHelpers {
.withNonce(Utils.BigNumber.make(nonce))
.createOne();

// @ts-ignore
await Utils.http.post("http://127.0.0.1:4003/api/transactions", {
body: {
// @ts-ignore - object can't be assigned to primitive
transactions: [transaction],
},
headers: { "Content-Type": "application/json" },
});
await this.request("POST", "transactions", { transactions: [transaction] });

return transaction;
}
Expand Down

0 comments on commit 3ac7a03

Please sign in to comment.