bot-api/tests/auth.test.ts

22 lines
637 B
TypeScript
Raw Normal View History

2023-12-27 19:33:25 +00:00
import { describe, expect, it, mock } from "bun:test";
import request from "supertest";
import { app } from "../src";
describe("/login", async () => {
const correctRespose = await request(app).post("/login").send({
app: "tester",
secret: "test",
});
it("should return 200 for correct login", () => {
expect(correctRespose.status).toBe(200);
});
it("should contain a token", () => {
expect(correctRespose.body).toHaveProperty("token");
});
it("should return 403 for invalid credentials", async () => {
const res = await request(app).post("/login").send({});
expect(res.status).toBe(403);
});
});