chore: add variant scoring fields, fix tie handling, and fix test files for normalizedName

This commit is contained in:
2026-03-30 22:48:31 -07:00
parent fb04a6c3f1
commit 5d1755f082
9 changed files with 174 additions and 35 deletions
@@ -32,6 +32,8 @@ const mockTournament = {
status: 'planned',
maxParticipants: 16,
ownerId: null,
targetScore: null,
allowTies: false,
createdAt: new Date(),
updatedAt: new Date(),
}
+5
View File
@@ -98,6 +98,7 @@ test.describe('Elo Rating Updates', () => {
const player1 = await prisma.player.create({
data: {
name: 'Elo Test Player 1',
normalizedName: 'elo test player 1',
currentElo: 1500,
gamesPlayed: 0,
wins: 0,
@@ -108,6 +109,7 @@ test.describe('Elo Rating Updates', () => {
const player2 = await prisma.player.create({
data: {
name: 'Elo Test Player 2',
normalizedName: 'elo test player 2',
currentElo: 1500,
gamesPlayed: 0,
wins: 0,
@@ -118,6 +120,7 @@ test.describe('Elo Rating Updates', () => {
const player3 = await prisma.player.create({
data: {
name: 'Elo Test Player 3',
normalizedName: 'elo test player 3',
currentElo: 1500,
gamesPlayed: 0,
wins: 0,
@@ -128,6 +131,7 @@ test.describe('Elo Rating Updates', () => {
const player4 = await prisma.player.create({
data: {
name: 'Elo Test Player 4',
normalizedName: 'elo test player 4',
currentElo: 1500,
gamesPlayed: 0,
wins: 0,
@@ -369,6 +373,7 @@ ${tournament.id},2,1,${player1.name},${player3.name},10,${player2.name},${player
const player = await prisma.player.create({
data: {
name: 'Elo Test Profile Player',
normalizedName: 'elo test profile player',
currentElo: 1750,
gamesPlayed: 50,
wins: 30,
+11 -5
View File
@@ -7,9 +7,11 @@ test.describe('Home Page', () => {
const timestamp = Date.now()
const players = []
for (let i = 0; i < 3; i++) {
const playerName = `Home Test Player ${timestamp} ${i + 1}`
const player = await prisma.player.create({
data: {
name: `Home Test Player ${timestamp} ${i + 1}`,
name: playerName,
normalizedName: playerName.toLowerCase(),
currentElo: 2000 - i * 10, // Very high Elo to ensure they're in top 10
gamesPlayed: 10 + i,
wins: 5 + Math.floor(i / 2),
@@ -71,17 +73,21 @@ test.describe('Home Page', () => {
})
// Create players for the match
const player1Name = `Home Match Player 1 ${timestamp}`
const player1 = await prisma.player.create({
data: { name: `Home Match Player 1 ${timestamp}`, currentElo: 1500 },
data: { name: player1Name, normalizedName: player1Name.toLowerCase(), currentElo: 1500 },
})
const player2Name = `Home Match Player 2 ${timestamp}`
const player2 = await prisma.player.create({
data: { name: `Home Match Player 2 ${timestamp}`, currentElo: 1480 },
data: { name: player2Name, normalizedName: player2Name.toLowerCase(), currentElo: 1480 },
})
const player3Name = `Home Match Player 3 ${timestamp}`
const player3 = await prisma.player.create({
data: { name: `Home Match Player 3 ${timestamp}`, currentElo: 1450 },
data: { name: player3Name, normalizedName: player3Name.toLowerCase(), currentElo: 1450 },
})
const player4Name = `Home Match Player 4 ${timestamp}`
const player4 = await prisma.player.create({
data: { name: `Home Match Player 4 ${timestamp}`, currentElo: 1420 },
data: { name: player4Name, normalizedName: player4Name.toLowerCase(), currentElo: 1420 },
})
// Create a match in the tournament