ConceptCreator/e2e/game-model/gamesystems/conditions/ConditionExpansion.spec.ts
Sebastian Böckelmann 75815578dc
Some checks failed
E2E Testing / test (push) Failing after 1m39s
Fix typo in gamemodel import path in test
2024-03-22 08:10:22 +01:00

45 lines
2.3 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";
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)
})
});