fix: mount /apps and docker socket in PR workflow build-and-deploy-ci job #41

Merged
david merged 33 commits from fix/switch-to-npm-ci into main 2026-05-20 19:51:36 +00:00
Showing only changes of commit b162750a67 - Show all commits
+24 -11
View File
@@ -8,12 +8,32 @@ import { describe, it, expect, mock, beforeEach,} from 'bun:test';
// Create mock functions at module level
const eventFindUniqueMock = mock(async () => ({}));
const eventUpdateMock = mock(async () => ({}));
const canManageTournamentMock = mock(async () => ({ allowed: true }));
const canDeleteTournamentMock = mock(async () => ({ allowed: true }));
const userFindUniqueMock = mock(async () => ({
id: 'admin-1',
email: 'admin@example.com',
role: 'club_admin',
emailVerified: false,
name: null,
image: null,
playerId: null,
createdAt: new Date(),
updatedAt: new Date(),
}));
// Mock prisma first
// Mock auth-simple to return a valid session
mock.module('@/lib/auth-simple', () => ({
getSession: mock(async () => ({
user: { id: 'admin-1', email: 'admin@example.com' },
session: { token: 'test', expiresAt: new Date() }
})),
}));
// Mock prisma with user and event
mock.module('@/lib/prisma', () => ({
prisma: {
user: {
findUnique: userFindUniqueMock,
},
event: {
findUnique: eventFindUniqueMock,
update: eventUpdateMock,
@@ -21,12 +41,6 @@ mock.module('@/lib/prisma', () => ({
},
}));
// Mock the permissions module
mock.module('@/lib/permissions', () => ({
canManageTournament: canManageTournamentMock,
canDeleteTournament: canDeleteTournamentMock,
}));
// Import the route handler after mocking
import { PUT } from '@/app/api/tournaments/[id]/route';
import { prisma } from '@/lib/prisma';
@@ -36,8 +50,7 @@ describe('Tournament Update API', () => {
// Clear all mock history before each test
eventFindUniqueMock.mockClear();
eventUpdateMock.mockClear();
canManageTournamentMock.mockClear();
canDeleteTournamentMock.mockClear();
userFindUniqueMock.mockClear();
});
it('should update allowTies field when provided', async () => {