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

RobinTail / express-zod-api / 4410939844

pending completion
4410939844

Pull #880

github

GitHub
Merge 1f79a241a into 1ca06dc0d
Pull Request #880: Bump @typescript-eslint/eslint-plugin from 5.54.1 to 5.55.0

499 of 524 branches covered (95.23%)

1119 of 1119 relevant lines covered (100.0%)

385.91 hits per line

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

82.35
/src/depends-on-method.ts
1
import { Endpoint } from "./endpoint";
2
import { DependsOnMethodError } from "./errors";
168✔
3
import { Method } from "./method";
4

5
export class DependsOnMethod {
168✔
6
  constructor(
7
    public readonly methods: {
64✔
8
      [K in Method]?:
9
        | Endpoint<any, any, any, K, any, any, any, any>
10
        | Endpoint<any, any, any, Method, any, any, any, any>;
11
    }
12
  ) {
13
    (Object.keys(methods) as (keyof typeof methods)[]).forEach((key) => {
64✔
14
      if (key in methods) {
120✔
15
        const endpointMethods = methods[key]?.getMethods() || [];
120!
16
        if (!endpointMethods.includes(key)) {
120✔
17
          throw new DependsOnMethodError(
8✔
18
            `The endpoint assigned to the '${key}' parameter must have at least this method in its specification.\n` +
19
              "This error should prevent mistakes during the development process.\n" +
20
              "Example:\n\n" +
21
              `new ${this.constructor.name}({\n` +
22
              `  ${key}: endpointsFactory.build({\n` +
23
              `    methods: ['${key}', ` +
24
              ((methods[key]?.getMethods() || [])
16!
25
                .map((m) => `'${m}'`)
16✔
26
                .join(", ") || "...") +
27
              "]\n" +
28
              `    // or method: '${key}'\n` +
29
              "    ...\n" +
30
              "  })\n" +
31
              "});\n"
32
          );
33
        }
34
      }
35
    });
36
  }
37
}
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

© 2025 Coveralls, Inc