removed unneccesary files
This commit is contained in:
@@ -4,6 +4,7 @@ import { describe, it, expect, beforeEach, beforeAll, afterAll } from "vitest";
|
||||
import appFactory from "./appFactory";
|
||||
import { prisma, resetUser, ensureUser, U, cid, closePrisma } from "./helpers";
|
||||
import type { FastifyInstance } from "fastify";
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
let app: FastifyInstance;
|
||||
|
||||
@@ -34,9 +35,12 @@ describe("Variable Categories guard (sum=100)", () => {
|
||||
});
|
||||
|
||||
it("rejects create that would push sum away from 100", async () => {
|
||||
const csrf = randomUUID().replace(/-/g, "");
|
||||
const res = await request(app.server)
|
||||
.post("/variable-categories")
|
||||
.set("x-user-id", U)
|
||||
.set("x-csrf-token", csrf)
|
||||
.set("Cookie", `csrf=${csrf}`)
|
||||
.send({ name: "Oops", percent: 10, isSavings: false, priority: 99 });
|
||||
|
||||
expect(res.statusCode).toBe(400);
|
||||
@@ -45,9 +49,12 @@ describe("Variable Categories guard (sum=100)", () => {
|
||||
|
||||
it("rejects update that breaks the sum", async () => {
|
||||
const existing = await prisma.variableCategory.findFirst({ where: { userId: U } });
|
||||
const csrf = randomUUID().replace(/-/g, "");
|
||||
const res = await request(app.server)
|
||||
.patch(`/variable-categories/${existing!.id}`)
|
||||
.set("x-user-id", U)
|
||||
.set("x-csrf-token", csrf)
|
||||
.set("Cookie", `csrf=${csrf}`)
|
||||
.send({ percent: 90 });
|
||||
|
||||
expect(res.statusCode).toBe(400);
|
||||
|
||||
Reference in New Issue
Block a user