conekta
Version:
OpenAPI client for conekta
43 lines (37 loc) • 1.39 kB
text/typescript
import { TransactionsApi } from "../api";
import { baseTest } from "./base-test";
import { Configuration } from "../configuration";
describe("TransactionsApi", () => {
let client: TransactionsApi;
beforeAll(() => {
const config = new Configuration({ accessToken: "key_xxxxxxxx" });
client = new TransactionsApi(config, baseTest.BasePath);
});
describe("general", () => {
it("should be defined", () => {
expect(client).toBeDefined();
});
});
describe("Get Transaction", () => {
it("should get a transaction", async () => {
const id = "6456b6dfac0fd40001a64eb8";
const response = (await client.getTransaction(id)).data;
expect(response).toBeDefined();
expect(response.id).toEqual(id);
expect(response.object).toEqual("transaction");
});
});
describe("Get Transactions", () => {
it("should get transactions", async () => {
const response = (await client.getTransactions("es", undefined, 2)).data;
const data = (response as unknown as { data: any[]}).data
expect(response).toBeDefined();
expect(response.has_more).toBeTruthy();
expect(response.next_page_url).toBeDefined();
expect(response.previous_page_url).toBeNull();
expect(data.length).toBeGreaterThan(0);
expect(data[0].object).toEqual("transaction");
expect(data.length).toEqual(2);
});
});
});