style(test): format gif fixtures
This commit is contained in:
parent
644db170dd
commit
36659bed85
@ -80,12 +80,34 @@ describe("web media loading", () => {
|
|||||||
// Create a minimal valid GIF (1x1 pixel)
|
// Create a minimal valid GIF (1x1 pixel)
|
||||||
// GIF89a header + minimal image data
|
// GIF89a header + minimal image data
|
||||||
const gifBuffer = Buffer.from([
|
const gifBuffer = Buffer.from([
|
||||||
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, // GIF89a
|
0x47,
|
||||||
0x01, 0x00, 0x01, 0x00, // 1x1 dimensions
|
0x49,
|
||||||
0x00, 0x00, 0x00, // no global color table
|
0x46,
|
||||||
0x2c, 0x00, 0x00, 0x00, 0x00, // image descriptor
|
0x38,
|
||||||
0x01, 0x00, 0x01, 0x00, 0x00, // 1x1 image
|
0x39,
|
||||||
0x02, 0x01, 0x44, 0x00, 0x3b, // minimal LZW data + trailer
|
0x61, // GIF89a
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00, // 1x1 dimensions
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00, // no global color table
|
||||||
|
0x2c,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00,
|
||||||
|
0x00, // image descriptor
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x01,
|
||||||
|
0x00,
|
||||||
|
0x00, // 1x1 image
|
||||||
|
0x02,
|
||||||
|
0x01,
|
||||||
|
0x44,
|
||||||
|
0x00,
|
||||||
|
0x3b, // minimal LZW data + trailer
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const file = path.join(os.tmpdir(), `clawdis-media-${Date.now()}.gif`);
|
const file = path.join(os.tmpdir(), `clawdis-media-${Date.now()}.gif`);
|
||||||
@ -102,18 +124,19 @@ describe("web media loading", () => {
|
|||||||
|
|
||||||
it("preserves GIF from URL without JPEG conversion", async () => {
|
it("preserves GIF from URL without JPEG conversion", async () => {
|
||||||
const gifBytes = new Uint8Array([
|
const gifBytes = new Uint8Array([
|
||||||
0x47, 0x49, 0x46, 0x38, 0x39, 0x61,
|
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||||
0x01, 0x00, 0x01, 0x00,
|
0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02,
|
||||||
0x00, 0x00, 0x00,
|
0x01, 0x44, 0x00, 0x3b,
|
||||||
0x2c, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x01, 0x00, 0x01, 0x00, 0x00,
|
|
||||||
0x02, 0x01, 0x44, 0x00, 0x3b,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const fetchMock = vi.spyOn(globalThis, "fetch").mockResolvedValueOnce({
|
const fetchMock = vi.spyOn(globalThis, "fetch").mockResolvedValueOnce({
|
||||||
ok: true,
|
ok: true,
|
||||||
body: true,
|
body: true,
|
||||||
arrayBuffer: async () => gifBytes.buffer.slice(gifBytes.byteOffset, gifBytes.byteOffset + gifBytes.byteLength),
|
arrayBuffer: async () =>
|
||||||
|
gifBytes.buffer.slice(
|
||||||
|
gifBytes.byteOffset,
|
||||||
|
gifBytes.byteOffset + gifBytes.byteLength,
|
||||||
|
),
|
||||||
headers: { get: () => "image/gif" },
|
headers: { get: () => "image/gif" },
|
||||||
status: 200,
|
status: 200,
|
||||||
} as Response);
|
} as Response);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user