All files / src/test-routes/required-optional-params query-required-optional.ts

0% Statements 0/12
0% Branches 0/2
0% Functions 0/4
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26                                                   
import { app, ValidationError } from "../../api";
 
app.category("vanilla", () => {
  app.put("/reqopt/implicit/optional/query", "OptionalImplicitQuery", async (req) => {
    Iif (req.query.queryParameter) {
      throw new ValidationError("Expected query parameter to be null", null, req.query.queryParameter);
    }
    return { status: 200 };
  });
 
  // This API should never be called so remove the name for coverage.
  app.get("/reqopt/global/required/query", undefined, (req) => {
    return {
      status: 400,
      message: "Client library failed to throw when an explicitly required query parameter is not provided.",
    };
  });
 
  app.get("/reqopt/global/optional/query", "OptionalGlobalQuery", (req) => {
    Iif (req.query.optional_global_query) {
      throw new ValidationError("Expected query parameter to be null", null, req.query.queryParameter);
    }
    return { status: 200 };
  });
});