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

GEWIS / sudosos-backend / 25162857296

30 Apr 2026 11:28AM UTC coverage: 88.101% (-1.0%) from 89.114%
25162857296

push

github

web-flow
chore: migrate test runner from Mocha to Vitest (#884)

3922 of 4572 branches covered (85.78%)

Branch coverage included in aggregate %.

16 of 16 new or added lines in 12 files covered. (100.0%)

793 existing lines in 111 files now uncovered.

20090 of 22683 relevant lines covered (88.57%)

1125.84 hits per line

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

42.86
/src/controller/test-controller.ts
1
/**
1✔
2
 *  SudoSOS back-end API service.
3
 *  Copyright (C) 2026 Study association GEWIS
4
 *
5
 *  This program is free software: you can redistribute it and/or modify
6
 *  it under the terms of the GNU Affero General Public License as published
7
 *  by the Free Software Foundation, either version 3 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Affero General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Affero General Public License
16
 *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 *
18
 *  @license
19
 */
1✔
20

21
/**
1✔
22
 * This is the module page of the test-controller.
23
 *
24
 * @module internal/controllers
25
 */
1✔
26

27
import { Response } from 'express';
28
import log4js, { Logger } from 'log4js';
29
import BaseController, { BaseControllerOptions } from './base-controller';
30
import Policy from './policy';
31
import { RequestWithToken } from '../middleware/token-middleware';
32
import Notifier, { HelloWorldOptions } from '../notifications';
33
import { NotificationTypes } from '../notifications/notification-types';
34

35
export default class TestController extends BaseController {
1✔
36
  /**
1✔
37
   * Reference to the logger instance.
38
   */
1✔
39
  private logger: Logger = log4js.getLogger('TestController');
1✔
40

41
  /**
1✔
42
   * Creates a new test controller instance.
43
   * @param options - The options passed to the base controller.
44
   */
1✔
45
  public constructor(options: BaseControllerOptions) {
1✔
46
    super(options);
×
47
    this.configureLogger(this.logger);
×
UNCOV
48
  }
×
49

50
  /**
1✔
51
   * @inheritDoc
52
   */
1✔
53
  public getPolicy(): Policy {
1✔
54
    return {
×
UNCOV
55
      '/helloworld': {
×
UNCOV
56
        POST: {
×
57
          policy: async () => Promise.resolve(true),
×
UNCOV
58
          handler: this.helloWorld.bind(this),
×
UNCOV
59
        },
×
UNCOV
60
      },
×
UNCOV
61
    };
×
UNCOV
62
  }
×
63

64
  /**
1✔
65
   * POST /test/helloworld
66
   * @summary Get a beautiful Hello World email to your inbox
67
   * @operationId helloworld
68
   * @tags test- Operations of the test controller
69
   * @security JWT
70
   * @return 204 - Success
71
   * @return {string} 500 - Internal server error
72
   */
1✔
73
  public async helloWorld(req: RequestWithToken, res: Response): Promise<void> {
1✔
74
    this.logger.trace('Hello world email by', req.token.user.id);
×
75

76
    try {
×
77
      await Notifier.getInstance().notify({
×
UNCOV
78
        type: NotificationTypes.HelloWorld,
×
UNCOV
79
        userId: req.token.user.id,
×
UNCOV
80
        params: new HelloWorldOptions(req.token.user.firstName),
×
UNCOV
81
      });
×
82
      res.status(204).send();
×
UNCOV
83
    } catch (e) {
×
84
      res.status(500).json('Internal server error.');
×
UNCOV
85
    }
×
UNCOV
86
  }
×
87
}
1✔
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