test: update mocks for Prisma v7 stricter type checking

This commit is contained in:
2026-03-31 00:00:50 -07:00
parent 9649c62c28
commit 77de648200
4 changed files with 59 additions and 11 deletions
@@ -71,8 +71,12 @@ test.describe('CSV Upload Player Deduplication', () => {
try {
// Upload the CSV
const csvFileContent = fs.readFileSync(csvPath, 'utf-8');
const blob = new Blob([csvFileContent], { type: 'text/csv' });
const file = new File([blob], 'deduplication-test.csv', { type: 'text/csv' });
const formData = new FormData();
formData.append('csvFile', fs.createReadStream(csvPath), 'deduplication-test.csv');
formData.append('csvFile', file);
formData.append('eventId', testTournamentId.toString());
const response = await request.post('http://localhost:3000/api/matches/upload', {
@@ -97,11 +101,11 @@ test.describe('CSV Upload Player Deduplication', () => {
expect(dedupePlayers.length).toBe(2);
// Verify the players have the correct names (original case preserved)
const playerNames = dedupePlayers.map(p => p.name).sort();
const playerNames = dedupePlayers.map((p: { name: string }) => p.name).sort();
expect(playerNames).toEqual(['Dedupe Player', 'Dedupe Player2']);
// Verify each player has games played
dedupePlayers.forEach(player => {
dedupePlayers.forEach((player: { gamesPlayed: number }) => {
expect(player.gamesPlayed).toBeGreaterThan(0);
});
} finally {
@@ -121,8 +125,12 @@ test.describe('CSV Upload Player Deduplication', () => {
fs.writeFileSync(csvPath, csvContent);
try {
const csvFileContent = fs.readFileSync(csvPath, 'utf-8');
const blob = new Blob([csvFileContent], { type: 'text/csv' });
const file = new File([blob], 'whitespace-test.csv', { type: 'text/csv' });
const formData = new FormData();
formData.append('csvFile', fs.createReadStream(csvPath), 'whitespace-test.csv');
formData.append('csvFile', file);
formData.append('eventId', testTournamentId.toString());
const response = await request.post('http://localhost:3000/api/matches/upload', {
@@ -141,7 +149,7 @@ test.describe('CSV Upload Player Deduplication', () => {
});
// Verify no players have leading/trailing whitespace
whitespacePlayers.forEach(player => {
whitespacePlayers.forEach((player: { name: string, normalizedName: string }) => {
expect(player.name).toBe(player.name.trim());
expect(player.normalizedName).toBe(player.name.trim().toLowerCase());
});
@@ -174,8 +182,12 @@ test.describe('CSV Upload Player Deduplication', () => {
fs.writeFileSync(csvPath, csvContent);
try {
const csvFileContent = fs.readFileSync(csvPath, 'utf-8');
const blob = new Blob([csvFileContent], { type: 'text/csv' });
const file = new File([blob], 'aggregate-test.csv', { type: 'text/csv' });
const formData = new FormData();
formData.append('csvFile', fs.createReadStream(csvPath), 'aggregate-test.csv');
formData.append('csvFile', file);
formData.append('eventId', testTournamentId.toString());
const response = await request.post('http://localhost:3000/api/matches/upload', {