ConceptCreator/e2e/game-model/gamesystems/FindGamesystem.spec.ts

44 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-02-09 20:04:52 +01:00
import { test, expect } from '@playwright/test';
import {GameModel} from "../../../src/app/project/game-model/GameModel";
import {SimpleGamesystem} from "../../../src/app/project/game-model/gamesystems/SimpleGamesystem";
2024-02-09 20:04:52 +01:00
import {GamesystemTrainer} from "./GamesystemTrainer";
test.describe('Test Find Gamesystems', () => {
const GAMEMODELNAME: string = "GameModel";
const SIMPLEGAMESYSTEM_NAME: string = "Simple Gamesystem";
test('Find null or undefined Gamesystem', async () => {
const gameModel = new GameModel(GAMEMODELNAME);
expect(gameModel.findGamesystem(null)).toBeUndefined();
expect(gameModel.findGamesystem(undefined)).toBeUndefined();
})
test('Find non existend Gamesystem', async () => {
const gameModel = new GameModel(GAMEMODELNAME);
expect(gameModel.findGamesystem("Gamesystem")).toBeUndefined();
})
test("Find existend simple Gamesystem on top layer", async () => {
const gameModel = new GameModel(GAMEMODELNAME);
const gamesystem = new SimpleGamesystem(SIMPLEGAMESYSTEM_NAME);
gameModel.addGamesystem(gamesystem);
expect(gameModel.findGamesystem(SIMPLEGAMESYSTEM_NAME)).toBeDefined();
expect(gameModel.findGamesystem(SIMPLEGAMESYSTEM_NAME)).toEqual(gamesystem);
})
test('Find existent product gamesystem on top layer', async () => {
const gameModel = GamesystemTrainer.givenGameModelWithProductGamesytemOnTopLayer();
const result = gameModel.findGamesystem(GamesystemTrainer.TOP_PRODUCT_GAMESYSTEM_NAME);
expect(result).toBeDefined();
})
test('Find existent simple gamesystem on lower layer', async () => {
const gameModel = GamesystemTrainer.givenGameModelWithProductGamesytemOnTopLayer();
const result = gameModel.findGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEMNAME);
expect(result).toBeDefined();
})
});