22 lines
741 B
TypeScript
22 lines
741 B
TypeScript
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));
|
|
});
|
|
}); |