ConceptCreator/e2e/game-model/gamesystems/actions/RemoveActions.spec.ts

34 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-02-17 16:04:31 +01:00
import { test, expect } from '@playwright/test';
import {GamesystemTrainer} from "../GamesystemTrainer";
import {SimpleActionTrainer} from "./SimpleActionTrainer";
import {ScriptAccount} from "../../../../src/app/game-model/scriptAccounts/ScriptAccount";
import {ScriptAccountAction} from "../../../../src/app/game-model/gamesystems/actions/ScriptAccountAction";
import {SimpleTransition} from "../../../../src/app/game-model/gamesystems/transitions/SimpleTransition";
test.describe('Test Remove SimpleActions', () => {
test("Test Removing invalid Actions", async () => {
const transition = SimpleActionTrainer.withSingleAction();
transition.removeScriptAccountAction(null);
expect(transition.scriptAccountActions.length).toEqual(1)
transition.removeScriptAccountAction(undefined);
expect(transition.scriptAccountActions.length).toEqual(1);
})
test("Test removing unknown scriptAccount Action", async () => {
const transition = SimpleActionTrainer.withSingleAction();
const scriptAccount = new ScriptAccount("Test");
transition.removeScriptAccountAction(scriptAccount);
expect(transition.scriptAccountActions.length).toEqual(1);
})
test("Test removing known ScriptAccount", async () => {
const transition = SimpleActionTrainer.withSingleAction();
transition.removeScriptAccountAction(transition.scriptAccountActions[0].scriptAccount)
expect(transition.scriptAccountActions.length).toEqual(0);
})
});