refactor : forget this file
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { validateImageUploadFile } from "../cdn-images";
|
||||
|
||||
const png = new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]);
|
||||
|
||||
describe("image upload validation", () => {
|
||||
test("accepts a valid PNG signature", () => {
|
||||
expect(() =>
|
||||
validateImageUploadFile(
|
||||
{ name: "avatar.png", type: "image/png", size: png.length },
|
||||
png
|
||||
)
|
||||
).not.toThrow();
|
||||
});
|
||||
|
||||
test("rejects content that does not match the declared type", () => {
|
||||
expect(() =>
|
||||
validateImageUploadFile(
|
||||
{ name: "avatar.png", type: "image/png", size: 4 },
|
||||
new Uint8Array([1, 2, 3, 4])
|
||||
)
|
||||
).toThrow("contents do not match");
|
||||
});
|
||||
|
||||
test("rejects empty files", () => {
|
||||
expect(() =>
|
||||
validateImageUploadFile({ name: "avatar.png", type: "image/png", size: 0 })
|
||||
).toThrow("cannot be empty");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user