ConceptCreator/e2e/game-model/gamesystems/actions/RemoveActions.spec.ts
Sebastian Böckelmann f07cb270f1
All checks were successful
E2E Testing / test (push) Successful in 1m30s
Add and Remove Actions from Transition
2024-02-17 16:04:31 +01:00

34 lines
1.4 KiB
TypeScript

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);
})
});