Skip to content

Commit

Permalink
Merge pull request #65 from mediaopt/bugfix/36293-create-purchase-error
Browse files Browse the repository at this point in the history
#36293 fixed tests
  • Loading branch information
majidabbasimediaopt authored Apr 30, 2024
2 parents e8cc14e + 3e504d3 commit 0cb21cb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/services/services.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { getClientToken } from "./getClientToken";
import { createPayment } from "./createPayment";
import { CartInformation } from "../types";
import { CartInformation, RequestHeader } from "../types";
import { makeRequest } from "../api";

jest.mock("../api/request", () => {
return {
makeRequest: <ResponseType, T>(
sessionKey: string,
sessionValue: string,
requestHeader: RequestHeader,
url: string,
method?: string,
data?: T
Expand Down Expand Up @@ -54,15 +53,15 @@ jest.mock("../api/request", () => {

test("error on make request", () => {
expect.assertions(1);
return makeRequest("", "", "fail", "", 1).then((result) => {
return makeRequest({}, "fail", "", 1).then((result) => {
expect(result).toBeFalsy();
});
});

describe("Client token", () => {
test("getting clientToken", () => {
expect.assertions(2);
return getClientToken("", "", "getClientToken", "", 1).then((result) => {
return getClientToken({}, "getClientToken", "", 1).then((result) => {
expect(result).toHaveProperty("clientToken");
expect(result).toHaveProperty("paymentVersion");
});
Expand All @@ -73,7 +72,7 @@ describe("Create payment", () => {
test("creating payment", () => {
const cartInformation = {} as CartInformation;
expect.assertions(2);
return createPayment("", "", "createPayment", cartInformation).then(
return createPayment({}, "createPayment", cartInformation).then(
(result) => {
expect(result).toHaveProperty("amountPlanned");
expect(result).toHaveProperty("version");
Expand Down

0 comments on commit 0cb21cb

Please sign in to comment.