Compare commits
No commits in common. "98086640e5677ced41d9c9db7bde843c9627623b" and "88cdce819ba1d3c5fbcac510a47cbf320ed7c285" have entirely different histories.
98086640e5
...
88cdce819b
13
package.json
13
package.json
|
@ -3,20 +3,13 @@
|
||||||
"module": "index.ts",
|
"module": "index.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.11",
|
"bun-types": "latest"
|
||||||
"@types/supertest": "^6.0.1",
|
|
||||||
"bun-types": "latest",
|
|
||||||
"jest": "^29.7.0",
|
|
||||||
"supertest": "^6.3.3",
|
|
||||||
"ts-jest": "^29.1.1"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5.0.0"
|
"typescript": "^5.0.0"
|
||||||
},
|
},"scripts": {
|
||||||
"scripts": {
|
|
||||||
"start": "bun run src/index.ts",
|
"start": "bun run src/index.ts",
|
||||||
"dev": "bun --hot run src/index.ts",
|
"dev": "bun --hot run src/index.ts"
|
||||||
"test": "bun test"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/express": "^4.17.21",
|
"@types/express": "^4.17.21",
|
||||||
|
|
|
@ -2,7 +2,7 @@ import express from "express";
|
||||||
import mongoose from "mongoose";
|
import mongoose from "mongoose";
|
||||||
import ImageModel from "./ImageModel";
|
import ImageModel from "./ImageModel";
|
||||||
|
|
||||||
export const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
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));
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
Reference in New Issue