bot-api/tests/app.test.ts

22 lines
741 B
TypeScript
Raw Normal View History

2023-12-25 11:15:19 +00:00
import { describe, expect, it } from "bun:test";
import request from "supertest";
import { app } from "../src";
describe("GET /images works properly", () => {
it("should be an array", async () => {
const res = await request(app).get("/images");
expect(Array.isArray(res.body)).toBeTrue();
expect(res.statusCode).toBe(200);
});
});
describe("POST /images works properly", () => {
it("should return 201 or 409", async () => {
const res = await request(app).post("/images").send({
url: "https://test.url.com/123",
status: "available",
tags: ["2girls", "touhou"]
});
expect(res.status).toSatisfy(status => [201, 409].includes(status));
});
});