• 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

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

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

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

13
    const patient = await Game.findById(id);
2✔
14

15
    if (!patient)
2!
16
      return res
2✔
17
        .status(404)
18
        .json({ error: `Juego con id (${id}) no encontrado` });
19

NEW
20
    return res.status(200).json(patient);
×
21
  } catch (error) {
NEW
22
    return res.status(500).json({
×
23
      error:
24
        error instanceof Error
×
25
          ? error.message
26
          : 'Error interno del servidor desconocido',
27
    });
28
  }
29
}
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