Skip to content

Commit

Permalink
Refactor Datatypes/index.test.js to use TypeScript + new client mock
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Aug 1, 2024
1 parent dd505b8 commit 589cd64
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import { useClientApiMock } from "@/api/client/__mocks__";

import { getDatatypesMapper } from "./index";
import { typesAndMappingResponse } from "./test_fixtures";

const { clientMock } = useClientApiMock();

clientMock.get("/api/datatypes/types_and_mapping", ({ response }) => {
return response(200).json(typesAndMappingResponse);
});

describe("Datatypes/index.js", () => {
describe("getDatatypesMapper", () => {
it("should fetch logic from API for comparing datatypes in a hierarchy", async () => {
fetchDatatypesAndMappings.mockResolvedValue(typesAndMappingResponse);
await getDatatypesMapper().then((mapper) => {
expect(mapper.isSubType("txt", "data")).toBe(true);
expect(mapper.isSubType("txt", "txt")).toBe(true);
Expand Down

0 comments on commit 589cd64

Please sign in to comment.