Skip to content

Bump up test timeout #1210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 58 additions & 33 deletions packages/openapi-typescript/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,68 @@ import { URL } from "node:url";

const cwd = new URL("../", import.meta.url);
const cmd = "./bin/cli.js";
const TIMEOUT = 90000;

describe("CLI", () => {
// note: the snapshots in index.test.ts test the Node API; these test the CLI
describe("snapshots", () => {
test("GitHub API", async () => {
const expected = fs.readFileSync(new URL("./examples/github-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/github-api.yaml"], { cwd });
expect(stdout).toBe(expected);
}, 30000);
test("GitHub API (next)", async () => {
const expected = fs.readFileSync(new URL("./examples/github-api-next.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/github-api-next.yaml"], { cwd });
expect(stdout).toBe(expected);
}, 30000);
test("Octokit GHES 3.6 Diff to API", async () => {
const expected = fs.readFileSync(new URL("./examples/octokit-ghes-3.6-diff-to-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/octokit-ghes-3.6-diff-to-api.json"], { cwd });
expect(stdout).toBe(expected);
}, 30000);
test("Stripe API", async () => {
const expected = fs.readFileSync(new URL("./examples/stripe-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/stripe-api.yaml"], { cwd });
expect(stdout).toBe(expected);
}, 30000);
test("DigitalOcean API (remote $refs)", async () => {
const expected = fs.readFileSync(new URL("./examples/digital-ocean-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/digital-ocean-api/DigitalOcean-public.v2.yaml"], {
cwd,
});
expect(stdout).toBe(expected);
}, 60000);
test("stdin", async () => {
const expected = fs.readFileSync(new URL("./examples/stripe-api.ts", cwd), "utf8").trim();
const input = fs.readFileSync(new URL("./examples/stripe-api.yaml", cwd));
const { stdout } = await execa(cmd, { input });
expect(stdout).toBe(expected);
}, 30000);
test(
"GitHub API",
async () => {
const expected = fs.readFileSync(new URL("./examples/github-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/github-api.yaml"], { cwd });
expect(stdout).toBe(expected);
},
TIMEOUT
);
test(
"GitHub API (next)",
async () => {
const expected = fs.readFileSync(new URL("./examples/github-api-next.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/github-api-next.yaml"], { cwd });
expect(stdout).toBe(expected);
},
TIMEOUT
);
test(
"Octokit GHES 3.6 Diff to API",
async () => {
const expected = fs.readFileSync(new URL("./examples/octokit-ghes-3.6-diff-to-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/octokit-ghes-3.6-diff-to-api.json"], { cwd });
expect(stdout).toBe(expected);
},
TIMEOUT
);
test(
"Stripe API",
async () => {
const expected = fs.readFileSync(new URL("./examples/stripe-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/stripe-api.yaml"], { cwd });
expect(stdout).toBe(expected);
},
TIMEOUT
);
test(
"DigitalOcean API (remote $refs)",
async () => {
const expected = fs.readFileSync(new URL("./examples/digital-ocean-api.ts", cwd), "utf8").trim();
const { stdout } = await execa(cmd, ["./examples/digital-ocean-api/DigitalOcean-public.v2.yaml"], {
cwd,
});
expect(stdout).toBe(expected);
},
TIMEOUT
);
test(
"stdin",
async () => {
const expected = fs.readFileSync(new URL("./examples/stripe-api.ts", cwd), "utf8").trim();
const input = fs.readFileSync(new URL("./examples/stripe-api.yaml", cwd));
const { stdout } = await execa(cmd, { input });
expect(stdout).toBe(expected);
},
TIMEOUT
);
});

describe("flags", () => {
Expand Down