File tree Expand file tree Collapse file tree 4 files changed +16
-10
lines changed
Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 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" ;
44import { nanoid } from "nanoid" ;
55import { NextRequest } from "next/server" ;
66import z from "zod" ;
Original file line number Diff line number Diff 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
2424import { NextRequest } from "next/server" ;
2525import { POST } from "../api/contact/route" ;
26- import { notifyContactCreated } from "../( helpers) /slack" ;
26+ import { notifyContactCreated } from "../../ helpers/slack" ;
2727
2828const mockSlack = notifyContactCreated as jest . Mock ;
2929
@@ -50,7 +50,10 @@ const mockNoConsent = {
5050
5151describe ( "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 ) ;
Original file line number Diff line number Diff 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
2525const mockSlack = notifyContactCreated as jest . Mock ;
2626
2727const 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
3636describe ( "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 ) ;
Original file line number Diff line number Diff line change 1- import { notifyContactCreated , createPayload } from "../( helpers) /slack" ;
1+ import { notifyContactCreated , createPayload } from "../../ helpers/slack" ;
22
33const mockData = {
44 name : "Test name" ,
You can’t perform that action at this time.
0 commit comments