* build(deps-dev): bump eslint from 8.57.1 to 9.13.0 Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.13.0. - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.57.1...v9.13.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Upgrade EsLint * Fix all new lint errors --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
|
|
import * as convenienceFunctions from "@util/convenience-functions";
|
|
|
|
import { Media } from "./media";
|
|
|
|
describe("Media", () => {
|
|
beforeEach(() => {
|
|
vi.spyOn(convenienceFunctions, "uniqueId").mockReturnValue("test");
|
|
});
|
|
|
|
afterEach(() => {
|
|
vi.resetAllMocks();
|
|
});
|
|
|
|
describe("#Array", () => {
|
|
it("Get images as array", () => {
|
|
const media = new Media();
|
|
|
|
media.addImage("test2.png", {
|
|
type: "png",
|
|
data: Buffer.from(""),
|
|
fileName: "test.png",
|
|
transformation: {
|
|
pixels: {
|
|
x: Math.round(100),
|
|
y: Math.round(100),
|
|
},
|
|
flip: {
|
|
vertical: true,
|
|
horizontal: true,
|
|
},
|
|
emus: {
|
|
x: Math.round(1 * 9525),
|
|
y: Math.round(1 * 9525),
|
|
},
|
|
rotation: 90,
|
|
},
|
|
});
|
|
|
|
const array = media.Array;
|
|
expect(array).to.be.an.instanceof(Array);
|
|
expect(array.length).to.equal(1);
|
|
|
|
const image = array[0];
|
|
expect(image.fileName).to.equal("test.png");
|
|
expect(image.transformation).to.deep.equal({
|
|
pixels: {
|
|
x: 100,
|
|
y: 100,
|
|
},
|
|
flip: {
|
|
vertical: true,
|
|
horizontal: true,
|
|
},
|
|
emus: {
|
|
x: 9525,
|
|
y: 9525,
|
|
},
|
|
rotation: 90,
|
|
});
|
|
});
|
|
});
|
|
});
|