42 lines
2.1 KiB
TypeScript
42 lines
2.1 KiB
TypeScript
|
|
import { test, expect } from '@playwright/test';
|
|
import {ScriptAccountCondition} from "../../../../src/app/project/game-model/gamesystems/conditions/ScriptAccountCondition";
|
|
import {ScriptAccount} from "../../../../src/app/project/game-model/scriptAccounts/ScriptAccount";
|
|
import exp = require("node:constants");
|
|
import {ConditionTrainer} from "./ConditionTrainer";
|
|
import {Conditional} from "@angular/compiler";
|
|
import {TransitionConditionTrainer} from "./TransitionConditionTrainer";
|
|
import {transition} from "@angular/animations";
|
|
test.describe('Test Adding Conditions To Transitions', () => {
|
|
|
|
test("Test adding not contradicting Conditions", async () => {
|
|
const transition = TransitionConditionTrainer.withTransitionWithCondition();
|
|
const condition = ScriptAccountCondition.constructScriptAccountCondition(new ScriptAccount("Test", ""), -200, -100);
|
|
|
|
transition.addScriptAccountCondition(condition);
|
|
expect(transition.scriptAccountConditions.length).toEqual(2);
|
|
expect(transition.scriptAccountConditions.includes(condition)).toBeTruthy();
|
|
})
|
|
|
|
test("Test adding contradicting Conditions", async () => {
|
|
const transition = TransitionConditionTrainer.withTransitionWithCondition();
|
|
const condition = ConditionTrainer.withContradictingCondition(transition.scriptAccountConditions[0]);
|
|
|
|
transition.addScriptAccountCondition(condition)
|
|
expect(transition.scriptAccountConditions.length).toEqual(1);
|
|
expect(transition.scriptAccountConditions.includes(condition)).toBeFalsy();
|
|
})
|
|
|
|
test("Test expanding Conditions", async () => {
|
|
const transition = TransitionConditionTrainer.withTransitionWithCondition();
|
|
const condition = ConditionTrainer.withExpendingCondition(transition.scriptAccountConditions[0]);
|
|
|
|
transition.addScriptAccountCondition(condition);
|
|
expect(transition.scriptAccountConditions.length).toEqual(1);
|
|
expect(transition.scriptAccountConditions.includes(condition)).toBeFalsy();
|
|
expect(transition.scriptAccountConditions[0].minValue).toEqual(-10)
|
|
expect(transition.scriptAccountConditions[0].maxValue).toEqual(20)
|
|
})
|
|
|
|
});
|