feat: gatsby source medusa (#924)

This commit is contained in:
Kasper Fabricius Kristensen authored and GitHub committed 2021-12-14 20:56:31 +01:00
1 parent d0d8dd7bf6
commit b8ff364276
18 files changed
+12013

No files matched your search

@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`helper functions should return return a new node from processNode 1`] = `
Array [
Object {
"children": Array [],
"description": "A test product",
"id": "prod_test_1234",
"internal": Object {
"content": "{\\"id\\":\\"prod_test_1234\\",\\"title\\":\\"Test Shirt\\",\\"description\\":\\"A test product\\",\\"unit_price\\":2500}",
"contentDigest": "digest_string",
"type": "MedusaProduct",
},
"parent": null,
"title": "Test Shirt",
"unit_price": 2500,
},
]
`;
@@ -0,0 +1,20 @@
const { processNode } = require("../src/process-node.ts");
describe("helper functions", () => {
it("should return return a new node from processNode", () => {
const fieldName = "product";
const node = {
id: "prod_test_1234",
title: "Test Shirt",
description: "A test product",
unit_price: 2500,
};
const createContentDigest = jest.fn(() => "digest_string");
const processNodeResult = processNode(node, fieldName, createContentDigest);
expect(createContentDigest).toBeCalled();
expect(processNodeResult).toMatchSnapshot();
});
});