chore: fix linting errors in tests and api routes
This commit is contained in:
@@ -13,7 +13,7 @@ const prisma = new PrismaClient();
|
||||
|
||||
test.describe('CSV Upload Player Deduplication', () => {
|
||||
let testTournamentId: number;
|
||||
let testPlayerIds: number[] = [];
|
||||
const testPlayerIds: number[] = [];
|
||||
|
||||
test.beforeAll(async () => {
|
||||
// Create a test tournament
|
||||
|
||||
@@ -13,13 +13,12 @@ const prisma = new PrismaClient();
|
||||
test.describe('Tournament Admin Permissions', () => {
|
||||
let tournamentId: number;
|
||||
let tournamentAdminEmail: string;
|
||||
let tournamentAdminPassword: string;
|
||||
|
||||
|
||||
test.beforeAll(async () => {
|
||||
// Create a test tournament admin user
|
||||
const timestamp = Date.now();
|
||||
tournamentAdminEmail = `tour-admin-${timestamp}@example.com`;
|
||||
tournamentAdminPassword = 'TourAdmin123!';
|
||||
|
||||
// Create user via API (simulating registration)
|
||||
// Note: In a real scenario, we'd use the auth API, but for this test
|
||||
@@ -66,7 +65,7 @@ test.describe('Tournament Admin Permissions', () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
|
||||
test('tournament_admin can access tournament detail page', async ({ page }) => {
|
||||
test('tournament_admin can access tournament detail page', async () => {
|
||||
// Note: This test would require authentication setup
|
||||
// For now, we'll verify the permission logic works correctly
|
||||
// by checking the canManageTournament function directly
|
||||
@@ -84,7 +83,7 @@ test.describe('Tournament Admin Permissions', () => {
|
||||
test.skip(true, 'Authentication setup required for full e2e test');
|
||||
});
|
||||
|
||||
test('tournament_admin cannot access other users tournaments', async ({ page }) => {
|
||||
test('tournament_admin cannot access other users tournaments', async () => {
|
||||
// Create another user's tournament
|
||||
const otherUser = await prisma.user.create({
|
||||
data: {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
import { describe, test, expect, vi, beforeEach } from 'vitest';
|
||||
import { canManageTournament, ownsTournament, hasRole, getManageableTournaments } from '@/lib/permissions';
|
||||
import { canManageTournament, ownsTournament, getManageableTournaments } from '@/lib/permissions';
|
||||
import { getSession } from '@/lib/auth-simple';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import type { User, Event } from '@prisma/client';
|
||||
@@ -53,6 +53,8 @@ const createMockTournament = (id: number, ownerId: string | null): Event => ({
|
||||
status: 'planned',
|
||||
maxParticipants: null,
|
||||
ownerId,
|
||||
targetScore: null,
|
||||
allowTies: false,
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user