import { test, expect } from '@playwright/test'; import {ScriptAccountCondition} from "../../../../src/app/project/gamemodel/gamesystems/conditions/ScriptAccountCondition"; import {ConditionTrainer} from "./ConditionTrainer"; test.describe('Test Expand Conditions', () => { test("Test expansion with contradiccting Conditions", async () => { const condition = ConditionTrainer.withSimpleCondition(); const otherCondition = ConditionTrainer.withContradictingCondition(condition); condition.extendCondition(otherCondition) expect(condition.minValue).toEqual(ConditionTrainer.withSimpleCondition().minValue); expect(condition.maxValue).toEqual(ConditionTrainer.withSimpleCondition().maxValue); }) test("Test lower expansion of Conditions", async () => { const condition = ConditionTrainer.withSimpleCondition(); const otherCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.minValue-10, condition.minValue+10) condition.extendCondition(otherCondition); expect(condition.minValue).toEqual(ConditionTrainer.withSimpleCondition().minValue-10) expect(condition.maxValue).toEqual(ConditionTrainer.withSimpleCondition().maxValue); }) test("Test higher expansion of conditions", async () => { const condition = ConditionTrainer.withSimpleCondition(); const otherCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.maxValue-10, condition.maxValue+10) condition.extendCondition(otherCondition) expect(condition.minValue).toEqual(ConditionTrainer.withSimpleCondition().minValue) expect(condition.maxValue).toEqual(ConditionTrainer.withSimpleCondition().maxValue+10) }) test("Test higher and lower Expansion of Conditions", async () => { const condition = ConditionTrainer.withSimpleCondition(); const otherCondition = ScriptAccountCondition.constructScriptAccountCondition(condition.scriptAccount, condition.minValue-10, condition.maxValue+10); condition.extendCondition(otherCondition); expect(condition.minValue).toEqual(ConditionTrainer.withSimpleCondition().minValue-10) expect(condition.maxValue).toEqual(ConditionTrainer.withSimpleCondition().maxValue+10) }) });