fix: tests not passing

This commit is contained in:
Mark Mankarious
2023-03-29 23:47:30 +01:00
parent c2cd64d2f2
commit 029bcf6606
4 changed files with 18 additions and 4 deletions

View File

@@ -1,5 +1,4 @@
import { makeAutoObservable } from "mobx";
import autoBind from "auto-bind";
import { Renderer } from "../renderer/Renderer";
import { ModeBase } from "./ModeBase";
import { Mouse } from "./types";
@@ -14,7 +13,6 @@ export class ModeManager {
constructor() {
makeAutoObservable(this);
autoBind(this);
}
setRenderer(renderer: Renderer) {

View File

@@ -12,7 +12,7 @@ describe("Mode manager functions correctly", () => {
const exitSpy = jest.spyOn(TestMode.prototype, "exit");
const eventSpy = jest.spyOn(TestMode.prototype, "TEST_EVENT");
const mouseEventSpy = jest.spyOn(TestMode.prototype, "MOUSE_MOVE");
const renderer = new Renderer({} as unknown as HTMLDivElement);
const renderer = new Renderer({} as unknown as HTMLDivElement, () => {});
const modeManager = new ModeManager();
modeManager.setRenderer(renderer);
modeManager.activateMode(TestMode);

View File

@@ -18,16 +18,28 @@ export const scene: SceneI = {
id: "node1",
label: "Node1",
icon: "icon1",
position: {
x: 0,
y: 0,
},
},
{
id: "node2",
label: "Node2",
icon: "icon2",
position: {
x: 1,
y: 1,
},
},
{
id: "node3",
label: "Node3",
icon: "icon1",
position: {
x: 2,
y: 2,
},
},
],
connectors: [

View File

@@ -23,7 +23,11 @@ describe("scene validation works correctly", () => {
test("finds invalid nodes in scene", () => {
const { icons } = scene;
const invalidNode = { id: "invalidNode", label: null, icon: "doesntExist" };
const invalidNode = {
id: "invalidNode",
icon: "doesntExist",
position: { x: -1, y: -1 },
};
const nodes: NodeI[] = [...scene.nodes, invalidNode];
const result = findInvalidNode(nodes, icons);