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

pmcelhaney / counterfact / 21184960617

20 Jan 2026 07:45PM UTC coverage: 81.801% (-0.1%) from 81.945%
21184960617

Pull #1483

github

pmcelhaney
add a $.delay() function, resolves #720
Pull Request #1483: add a $.delay() function, resolves #720

1157 of 1291 branches covered (89.62%)

Branch coverage included in aggregate %.

13 of 25 new or added lines in 5 files covered. (52.0%)

4 existing lines in 2 files now uncovered.

3621 of 4550 relevant lines covered (79.58%)

57.5 hits per line

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

95.6
/src/typescript-generator/operation-coder.js
1
import nodePath from "node:path";
2✔
2

2✔
3
import { Coder } from "./coder.js";
2✔
4
import { OperationTypeCoder } from "./operation-type-coder.js";
2✔
5

2✔
6
export class OperationCoder extends Coder {
2✔
7
  constructor(requirement, requestMethod, securitySchemes = {}) {
2✔
8
    super(requirement);
68✔
9

68✔
10
    if (requestMethod === undefined) {
68!
UNCOV
11
      throw new Error("requestMethod is required");
×
12
    }
×
13

68✔
14
    this.requestMethod = requestMethod;
68✔
15
    this.securitySchemes = securitySchemes;
68✔
16
  }
68✔
17

2✔
18
  names() {
2✔
19
    return super.names(this.requestMethod.toUpperCase());
60✔
20
  }
60✔
21

2✔
22
  write() {
2✔
23
    const responses = this.requirement.get("responses");
62✔
24

62✔
25
    const [firstStatusCode] = responses.map(
62✔
26
      (response, statusCode) => statusCode,
62✔
27
    );
62✔
28
    const [firstResponse] = responses.map((response) => response.data);
62✔
29

62✔
30
    if (!("content" in firstResponse || "schema" in firstResponse)) {
62✔
31
      return `async ($) => {
12✔
32
        return $.response[${
12✔
33
          firstStatusCode === "default" ? 200 : firstStatusCode
12✔
34
        }];
12✔
35
      }`;
12✔
36
    }
12✔
37

50✔
38
    return `async ($) => {
50✔
39
      return $.response[${
50✔
40
        firstStatusCode === "default" ? 200 : firstStatusCode
62✔
41
      }].random();
62✔
42
    }`;
62✔
43
  }
62✔
44

2✔
45
  typeDeclaration(namespace, script) {
2✔
46
    const operationTypeCoder = new OperationTypeCoder(
60✔
47
      this.requirement,
60✔
48
      this.requestMethod,
60✔
49
      this.securitySchemes,
60✔
50
    );
60✔
51

60✔
52
    return script.importType(operationTypeCoder);
60✔
53
  }
60✔
54

2✔
55
  modulePath() {
2✔
56
    const pathString = this.requirement.url
2✔
57
      .split("/")
2✔
58
      .at(-2)
2✔
59
      .replaceAll("~1", "/");
2✔
60

2✔
61
    return `${nodePath
2✔
62
      .join("routes", pathString)
2✔
63
      .replaceAll("\\", "/")}.types.ts`;
2✔
64
  }
2✔
65
}
2✔
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