This commit is contained in:
parent
40fb7c6ab7
commit
dda3aa4bed
@ -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();
|
||||||
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user