• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ULL-ESIT-INF-DSI-2526 / prct12_practica12 / 25431225842

06 May 2026 10:56AM UTC coverage: 60.317%. First build
25431225842

push

github

PabloPH05
Practica

9 of 20 branches covered (45.0%)

Branch coverage included in aggregate %.

29 of 43 new or added lines in 5 files covered. (67.44%)

29 of 43 relevant lines covered (67.44%)

2.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/functions/deleteGame.ts
1
import { Game } from '../data/gameSchema.js';
2
import mongoose from 'mongoose';
3
import { Request, Response } from 'express';
4

5
export async function deleteGame(req: Request, res: Response) {
NEW
6
  try {
×
NEW
7
    const id = req.params.id as string;
×
8

NEW
9
    if (!mongoose.Types.ObjectId.isValid(id)) {
×
NEW
10
      return res.status(400).json({ error: 'Formato de id invalido' });
×
11
    }
12

NEW
13
    const deletedPatient = await Game.findByIdAndDelete(id);
×
14

NEW
15
    if (!deletedPatient) {
×
NEW
16
      return res
×
17
        .status(404)
18
        .json({ error: `Juego con id (${id}) no encontrado no se pudo eliminar` });
19
    }
20

NEW
21
    return res.status(200).json(deletedPatient);
×
22
  } catch (error) {
NEW
23
    return res.status(500).json({
×
24
      error:
25
        error instanceof Error
×
26
          ? error.message
27
          : 'Error interno del servidor desconocido',
28
    });
29
  }
30
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc