Files
bitmappery/tests/unit/store/modules/canvas-module.spec.ts
Igor Zinken 3e3570021f Add strict type checks to unit tests (#48)
* Add strict type checks to unit tests
2025-02-15 14:14:48 +01:00

38 lines
1.5 KiB
TypeScript

import { it, describe, expect } from "vitest";
import storeModule, { createCanvasState } from "@/store/modules/canvas-module";
const { getters, mutations } = storeModule;
describe( "Vuex canvas module", () => {
describe( "getters", () => {
it( "should be able to retrieve the zCanvas instance dimensions", () => {
const state = createCanvasState({
canvasDimensions: {
width: 10, height: 5, horizontalDominant: false,
visibleWidth: 7, visibleHeight: 3, maxInScale: 1, maxOutScale: 1
}
});
expect( getters.canvasDimensions( state, getters, {}, {} )).toEqual( state.canvasDimensions );
});
});
describe( "mutations", () => {
it( "should be able to set the zCanvas instance dimensions", () => {
const state = {
canvasDimensions: {
width: 10, height: 5, horizontalDominant: false,
visibleWidth: 7, visibleHeight: 3, maxInScale: 1, maxOutScale: 1
}
};
mutations.setCanvasDimensions( state, {
width: 50, height: 40, horizontalDominant: true,
visibleWidth: 40, visibleHeight: 20, maxInScale: 5, maxOutScale: 10
});
expect( state.canvasDimensions ).toEqual({
width: 50, height: 40, horizontalDominant: true,
visibleWidth: 40, visibleHeight: 20, maxInScale: 5, maxOutScale: 10
});
});
});
});