mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test: migrate last dynamic format-decoders fixture ref to registry
This commit is contained in:
@@ -1,13 +1,9 @@
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import sharp from "sharp";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { decodeToSharpCompat, needsCliDecode } from "../../../apps/api/src/lib/format-decoders.js";
|
||||
import { encodeQoi } from "../../../apps/api/src/lib/format-encoders.js";
|
||||
import { fixtures, readFixture } from "../../fixtures/index.js";
|
||||
|
||||
const FIXTURES = join(__dirname, "../../fixtures");
|
||||
|
||||
function isImageMagickError(err: unknown): boolean {
|
||||
if (!(err instanceof Error)) return false;
|
||||
return err.message.includes("No ImageMagick") || err.message.includes("ENOENT");
|
||||
@@ -366,7 +362,7 @@ describe("decodeToSharpCompat - individual decoder verification", () => {
|
||||
for (const fmt of formats) {
|
||||
it(`${fmt}: output has non-zero dimensions`, async () => {
|
||||
try {
|
||||
const input = await readFile(join(FIXTURES, `formats/sample.${fmt}`));
|
||||
const input = readFixture(fixtures.image.formats(fmt));
|
||||
const result = await decodeToSharpCompat(input, fmt);
|
||||
const { width, height } = await assertValidImage(result);
|
||||
expect(width).toBeGreaterThan(0);
|
||||
@@ -383,7 +379,7 @@ describe("decodeToSharpCompat - individual decoder verification", () => {
|
||||
for (const fmt of delegateFormats) {
|
||||
it(`${fmt}: output has non-zero dimensions (requires delegate)`, async () => {
|
||||
try {
|
||||
const input = await readFile(join(FIXTURES, `formats/sample.${fmt}`));
|
||||
const input = readFixture(fixtures.image.formats(fmt));
|
||||
const result = await decodeToSharpCompat(input, fmt);
|
||||
const { width, height } = await assertValidImage(result);
|
||||
expect(width).toBeGreaterThan(0);
|
||||
|
||||
Reference in New Issue
Block a user