D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
washeet.softurecs.com
/
node_modules
/
@jimp
/
plugin-flip
/
src
/
Filename :
index.test.ts
back
Copy
import { describe, expect, test } from "vitest"; import { createJimp } from "@jimp/core"; import { makeTestImage } from "@jimp/test-utils"; import { methods } from "./index.js"; const jimp = createJimp({ plugins: [methods] }); describe("Flipping plugin", () => { test("can flip horizontally", () => { const src = jimp.fromBitmap( makeTestImage( "AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA", ), ); expect(src.flip({ horizontal: true })).toMatchSnapshot(); }); test("can flip vertically", () => { const src = jimp.fromBitmap( makeTestImage( "AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA", ), ); expect(src.flip({ vertical: true })).toMatchSnapshot(); }); test("can flip both horizontally and vertically at once", async () => { const src = jimp.fromBitmap( makeTestImage( "AAAABBBB", "AAABAAAB", "ABABABAB", "CCCCCCCC", "CCCCCCCC", "CCCCCCCC", "AACCCCAA", ), ); expect(src.flip({ horizontal: true, vertical: true })).toMatchSnapshot(); }); });