From 0566e69008983b096adab48ab98dfa183a7e4885 Mon Sep 17 00:00:00 2001 From: Joseph Martinsen Date: Sat, 10 Apr 2021 18:10:40 -0500 Subject: [PATCH] close to 100% without integration tests --- __tests__/testing-library.tsx | 9 --------- pages/api/hello.ts | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 __tests__/testing-library.tsx diff --git a/__tests__/testing-library.tsx b/__tests__/testing-library.tsx deleted file mode 100644 index fc1b766..0000000 --- a/__tests__/testing-library.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from "react"; -import { render } from "@testing-library/react"; -import Index from "../pages/index"; - -test("renders deploy link", () => { - const { getByText } = render(); - const linkElement = getByText(/Instantly deploy your Next\.js site to a public URL with Vercel\./); - expect(linkElement).toBeInTheDocument(); -}); diff --git a/pages/api/hello.ts b/pages/api/hello.ts index 4ec6e33..0d352b0 100644 --- a/pages/api/hello.ts +++ b/pages/api/hello.ts @@ -1,6 +1,14 @@ import { NextApiRequest, NextApiResponse } from "next"; // Next.js API route support: https://nextjs.org/docs/api-routes/introduction +export interface HelloResponseType { + name: string; +} + +export const helloResponse = (): HelloResponseType => { + return { name: "John Doe" }; +}; + export default (req: NextApiRequest, res: NextApiResponse) => { - res.status(200).json({ name: "John Doe" }); + res.status(200).json(helloResponse()); };