refactor-component-creation #47
| @ -1,44 +0,0 @@ | |||||||
| import { test, expect } from '@playwright/test'; |  | ||||||
| import {GamesystemTrainer} from "./GamesystemTrainer"; |  | ||||||
| import {ProductGamesystem} from "../../../src/app/project/game-model/gamesystems/ProductGamesystem"; |  | ||||||
| test.describe('Test Create Gamesystems', () => { |  | ||||||
| 
 |  | ||||||
|   test('Test creating gamesystem with invalid name', async => { |  | ||||||
|     const gameModel = GamesystemTrainer.givenEmptyGameModel(); |  | ||||||
|     let result = gameModel.createGamesystem(undefined, undefined); |  | ||||||
|     expect(result).toBeUndefined(); |  | ||||||
| 
 |  | ||||||
|     result = gameModel.createGamesystem(null, undefined); |  | ||||||
|     expect(result).toBeUndefined(); |  | ||||||
|   }) |  | ||||||
| 
 |  | ||||||
|   test("Test creating gamesystem with valid name but without parent", async => { |  | ||||||
|     const gameModel = GamesystemTrainer.givenEmptyGameModel(); |  | ||||||
|     let result = gameModel.createGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEMNAME, undefined); |  | ||||||
|     expect(result).toBeDefined(); |  | ||||||
|     expect(gameModel.gamesystems.length).toEqual(1); |  | ||||||
|     expect(gameModel.findGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEMNAME)).toBeDefined(); |  | ||||||
|   }) |  | ||||||
| 
 |  | ||||||
|   test("Test creating Gamesystem with valid name but with Product Parent", async => { |  | ||||||
|     const gameModel = GamesystemTrainer.givenGameModelWithProductGamesytemOnTopLayer(); |  | ||||||
|     let result = gameModel.createGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEM_LEAF_LEFT, GamesystemTrainer.TOP_PRODUCT_GAMESYSTEM_NAME); |  | ||||||
|     expect(result).toBeDefined(); |  | ||||||
|     expect(result.parentGamesystem!.componentName).toEqual(GamesystemTrainer.TOP_PRODUCT_GAMESYSTEM_NAME); |  | ||||||
|     expect(result.parentGamesystem!.innerGamesystems.length).toEqual(3); |  | ||||||
|     expect(result.parentGamesystem!.innerGamesystems.includes(result)).toBeTruthy(); |  | ||||||
|   }) |  | ||||||
| 
 |  | ||||||
|   test("Test creating Gamesystem with valid name but with Simple Parent", async() => { |  | ||||||
|     const gameModel = GamesystemTrainer.givenGameModelWithSimpleGamesystemOnTopLayer(); |  | ||||||
|     let result = gameModel.createGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEM_LEAF_LEFT, GamesystemTrainer.SIMPLEGAMESYSTEMNAME); |  | ||||||
|     expect(result).toBeDefined(); |  | ||||||
|     expect(gameModel.gamesystems.length).toEqual(1); |  | ||||||
|     expect(gameModel.gamesystems[0]).toBeInstanceOf(ProductGamesystem); |  | ||||||
|     expect(gameModel.gamesystems[0]).toEqual(result.parentGamesystem); |  | ||||||
|     expect((gameModel.gamesystems[0] as ProductGamesystem).innerGamesystems.length).toEqual(1); |  | ||||||
|     expect((gameModel.gamesystems[0] as ProductGamesystem).innerGamesystems.includes(result)).toBeTruthy(); |  | ||||||
|   }) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| }); |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user