Skip to content

Commit 20bdf75

Browse files
committed
Fixed imports
1 parent 6e3f2a9 commit 20bdf75

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

apps/contact/app/api/contact/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//import { ContactTemplate } from "@/email-templates/contact";
22
//import { sendEmail } from "@/helpers/email";
3-
import { processContact } from "@/helpers/notion";
3+
import { processContact } from "../../../helpers/notion";
44
import { nanoid } from "nanoid";
55
import { NextRequest } from "next/server";
66
import z from "zod";

apps/contact/app/tests/contactApi.test.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jest.mock("@notionhq/client", () => {
1313
};
1414
});
1515

16-
jest.mock("../(helpers)/slack", () => {
16+
jest.mock("../../helpers/slack", () => {
1717
return {
1818
notifyContactCreated: jest.fn(),
1919
};
@@ -23,7 +23,7 @@ process.env.NOTION_DATABASE_ID = "mocked-notion-database-id";
2323

2424
import { NextRequest } from "next/server";
2525
import { POST } from "../api/contact/route";
26-
import { notifyContactCreated } from "../(helpers)/slack";
26+
import { notifyContactCreated } from "../../helpers/slack";
2727

2828
const mockSlack = notifyContactCreated as jest.Mock;
2929

@@ -50,7 +50,10 @@ const mockNoConsent = {
5050

5151
describe("POST /api/contact", () => {
5252
beforeEach(() => {
53-
mockNotion.mockResolvedValue({ id: "fake-page-id" });
53+
mockNotion.mockResolvedValue({
54+
id: "fake-page-id",
55+
url: "https://www.notion.so/Message-from-Test-123456789-fakepageid",
56+
});
5457
mockSlack.mockResolvedValue({ message: "success" });
5558
const { isFullPage } = require("@notionhq/client");
5659
isFullPage.mockImplementation(() => true);

apps/contact/app/tests/notion.test.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ jest.mock("@notionhq/client", () => {
1313
};
1414
});
1515

16-
jest.mock("../(helpers)/slack", () => {
16+
jest.mock("../../helpers/slack", () => {
1717
return {
1818
notifyContactCreated: jest.fn(),
1919
};
2020
});
2121

22-
import { notifyContactCreated } from "../(helpers)/slack";
23-
import { processContact } from "../(helpers)/notion";
22+
import { notifyContactCreated } from "../../helpers/slack";
23+
import { processContact } from "../../helpers/notion";
2424

2525
const mockSlack = notifyContactCreated as jest.Mock;
2626

2727
const mockData = {
28-
id: "123",
28+
id: "123456789",
2929
email: "test@test.com",
3030
name: "Test Test",
3131
message: "This is a test message",
@@ -35,7 +35,10 @@ const mockData = {
3535

3636
describe("Notion helper", () => {
3737
beforeEach(() => {
38-
mockNotion.mockResolvedValue({ id: "fake-page-id" });
38+
mockNotion.mockResolvedValue({
39+
id: "fake-page-id",
40+
url: "https://www.notion.so/Message-from-Test-Test-123456789-fakepageid",
41+
});
3942
mockSlack.mockResolvedValue({ message: "success" });
4043
const { isFullPage } = require("@notionhq/client");
4144
isFullPage.mockImplementation(() => true);

apps/contact/app/tests/slack.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { notifyContactCreated, createPayload } from "../(helpers)/slack";
1+
import { notifyContactCreated, createPayload } from "../../helpers/slack";
22

33
const mockData = {
44
name: "Test name",

0 commit comments

Comments
 (0)