react18-tools/turborepo-template

View on GitHub
examples/express/src/__tests__/server.test.ts

Summary

Maintainability
A
0 mins
Test Coverage
import supertest from "supertest";
import { createServer } from "../server";

describe("Server", () => {
  it("health check returns 200", async () => {
    await supertest(createServer())
      .get("/status")
      .expect(200)
      .then(res => {
        expect(res.ok).toBe(true);
      });
  });

  it("message endpoint says hello", async () => {
    await supertest(createServer())
      .get("/message/jared")
      .expect(200)
      .then(res => {
        expect(res.body).toEqual({ message: "hello jared" });
      });
  });
});