feat: implement groups risk overview feature with analytics and routes

This commit is contained in:
Jose Selesan
2026-09-24 20:45:11 -03:00
parent 2e184845e1
commit efde1aaf33
11 changed files with 382 additions and 16 deletions

View File

@@ -65,7 +65,7 @@ function makeSession(overrides: Record<string, unknown> = {}) {
return {
id: 'session-1',
groupId: 'group-1',
startsAt: new Date('2026-09-23T19:00:00.000Z'),
startsAt: todayAtUtc(),
group: {
id: 'group-1',
name: 'Funcional',
@@ -77,6 +77,13 @@ function makeSession(overrides: Record<string, unknown> = {}) {
};
}
// Fecha "hoy" a las 19:00 UTC, del día real del runner.
function todayAtUtc() {
const date = new Date();
date.setUTCHours(19, 0, 0, 0);
return date;
}
describe('classes routes', () => {
beforeEach(() => {
vi.clearAllMocks();
@@ -85,7 +92,7 @@ describe('classes routes', () => {
describe('GET /classes/today', () => {
it('materializa y lista las clases de hoy del profesor', async () => {
const startsAt = new Date('2026-09-23T19:00:00.000Z');
const startsAt = todayAtUtc();
prisma.group.findMany.mockResolvedValue([
{
id: 'group-1',
@@ -432,7 +439,7 @@ describe('classes routes', () => {
})
.format(new Date())
.toUpperCase();
const startsAt = new Date('2026-09-23T19:00:00.000Z');
const startsAt = todayAtUtc();
prisma.attendee.findUnique.mockResolvedValue({
id: 'attendee-1',