issue-5-gamesystems #6

Merged
sebastian merged 24 commits from issue-5-gamesystems into main 2024-02-10 12:30:37 +00:00
Showing only changes of commit dda3aa4bed - Show all commits

View File

@ -139,6 +139,34 @@ test.describe('Test SimpleGamesystem', () => {
}) })
test("Remove SimpleTransition", async () => { test("Remove SimpleTransition", async () => {
const gamesystem = new SimpleGamesystem("Gamesystem");
const A = gamesystem.createState("A");
const B = gamesystem.createState("B");
let AB = gamesystem.createTransition(A, B);
let result = gamesystem.removeTransition(AB);
expect(result).toBeTruthy();
expect(gamesystem.transitions.includes(AB)).toBeFalsy();
AB = gamesystem.createTransition(A, B);
const C = gamesystem.createState("C");
const D = gamesystem.createState("D");
let CD = gamesystem.createTransition(C, D);
result = gamesystem.removeTransition(AB);
expect(result).toBeTruthy();
expect(gamesystem.transitions.includes(AB)).toBeFalsy();
expect(gamesystem.transitions.includes(CD)).toBeTruthy();
let BA = gamesystem.createTransition(B, A);
AB = gamesystem.createTransition(A, B);
result = gamesystem.removeTransition(AB);
expect(result).toBeTruthy();
expect(gamesystem.transitions.includes(AB)).toBeFalsy();
expect(gamesystem.transitions.includes(BA)).toBeTruthy();
result = gamesystem.removeTransition(AB);
expect(result).toBeFalsy();
}) })
}); });