From a04df8b85b6fa37741e8a6d92b43d153ddc82b03 Mon Sep 17 00:00:00 2001 From: William Grosset Date: Tue, 27 Feb 2024 15:26:01 -0700 Subject: [PATCH] Clean up test files (reduce LoC) --- src/main/contestants/team/index.test.ts | 8 ++------ src/main/matches/team-duel/index.test.ts | 13 ++++--------- .../matches/team-free-for-all/index.test.ts | 19 ++++++------------- 3 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/main/contestants/team/index.test.ts b/src/main/contestants/team/index.test.ts index f6ff06b..6b0a9c3 100644 --- a/src/main/contestants/team/index.test.ts +++ b/src/main/contestants/team/index.test.ts @@ -5,13 +5,9 @@ describe('Team', () => { let team: Team beforeEach(() => { - const player1 = new Player('1', 1000) - const player2 = new Player('2', 900) - team = new Team('1') - - team.addPlayer(player1) - team.addPlayer(player2) + team.addPlayer(new Player('1', 1000)) + team.addPlayer(new Player('2', 900)) }) test('adds players to team', () => { diff --git a/src/main/matches/team-duel/index.test.ts b/src/main/matches/team-duel/index.test.ts index a3e857c..9cb7cde 100644 --- a/src/main/matches/team-duel/index.test.ts +++ b/src/main/matches/team-duel/index.test.ts @@ -7,20 +7,15 @@ describe('TeamDuel', () => { let match: TeamDuel beforeEach(() => { - const player1 = new Player('1', 1000) - const player2 = new Player('2', 900) - const player3 = new Player('3', 800) - const player4 = new Player('4', 700) const team1 = new Team('1') const team2 = new Team('2') - team1.addPlayer(player1) - team1.addPlayer(player2) - team2.addPlayer(player3) - team2.addPlayer(player4) + team1.addPlayer(new Player('1', 1000)) + team1.addPlayer(new Player('2', 900)) + team2.addPlayer(new Player('3', 800)) + team2.addPlayer(new Player('4', 700)) match = new TeamDuel() - match.addTeam(team1) match.addTeam(team2) }) diff --git a/src/main/matches/team-free-for-all/index.test.ts b/src/main/matches/team-free-for-all/index.test.ts index fbefb31..abc0d60 100644 --- a/src/main/matches/team-free-for-all/index.test.ts +++ b/src/main/matches/team-free-for-all/index.test.ts @@ -7,25 +7,18 @@ describe('TeamFreeForAll', () => { let match: TeamFreeForAll beforeEach(() => { - const player1 = new Player('1', 1000) - const player2 = new Player('2', 900) - const player3 = new Player('3', 800) - const player4 = new Player('4', 700) - const player5 = new Player('5', 600) - const player6 = new Player('6', 500) const team1 = new Team('1') const team2 = new Team('2') const team3 = new Team('3') - team1.addPlayer(player1) - team1.addPlayer(player2) - team2.addPlayer(player3) - team2.addPlayer(player4) - team3.addPlayer(player5) - team3.addPlayer(player6) + team1.addPlayer(new Player('1', 1000)) + team1.addPlayer(new Player('2', 900)) + team2.addPlayer(new Player('3', 800)) + team2.addPlayer(new Player('4', 700)) + team3.addPlayer(new Player('5', 600)) + team3.addPlayer(new Player('6', 500)) match = new TeamFreeForAll() - match.addTeam(team1) match.addTeam(team2) match.addTeam(team3)