@@ -4,43 +4,68 @@ import { URL } from "node:url";
44
55const cwd = new URL ( "../" , import . meta. url ) ;
66const cmd = "./bin/cli.js" ;
7+ const TIMEOUT = 90000 ;
78
89describe ( "CLI" , ( ) => {
910 // note: the snapshots in index.test.ts test the Node API; these test the CLI
1011 describe ( "snapshots" , ( ) => {
11- test ( "GitHub API" , async ( ) => {
12- const expected = fs . readFileSync ( new URL ( "./examples/github-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
13- const { stdout } = await execa ( cmd , [ "./examples/github-api.yaml" ] , { cwd } ) ;
14- expect ( stdout ) . toBe ( expected ) ;
15- } , 30000 ) ;
16- test ( "GitHub API (next)" , async ( ) => {
17- const expected = fs . readFileSync ( new URL ( "./examples/github-api-next.ts" , cwd ) , "utf8" ) . trim ( ) ;
18- const { stdout } = await execa ( cmd , [ "./examples/github-api-next.yaml" ] , { cwd } ) ;
19- expect ( stdout ) . toBe ( expected ) ;
20- } , 30000 ) ;
21- test ( "Octokit GHES 3.6 Diff to API" , async ( ) => {
22- const expected = fs . readFileSync ( new URL ( "./examples/octokit-ghes-3.6-diff-to-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
23- const { stdout } = await execa ( cmd , [ "./examples/octokit-ghes-3.6-diff-to-api.json" ] , { cwd } ) ;
24- expect ( stdout ) . toBe ( expected ) ;
25- } , 30000 ) ;
26- test ( "Stripe API" , async ( ) => {
27- const expected = fs . readFileSync ( new URL ( "./examples/stripe-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
28- const { stdout } = await execa ( cmd , [ "./examples/stripe-api.yaml" ] , { cwd } ) ;
29- expect ( stdout ) . toBe ( expected ) ;
30- } , 30000 ) ;
31- test ( "DigitalOcean API (remote $refs)" , async ( ) => {
32- const expected = fs . readFileSync ( new URL ( "./examples/digital-ocean-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
33- const { stdout } = await execa ( cmd , [ "./examples/digital-ocean-api/DigitalOcean-public.v2.yaml" ] , {
34- cwd,
35- } ) ;
36- expect ( stdout ) . toBe ( expected ) ;
37- } , 60000 ) ;
38- test ( "stdin" , async ( ) => {
39- const expected = fs . readFileSync ( new URL ( "./examples/stripe-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
40- const input = fs . readFileSync ( new URL ( "./examples/stripe-api.yaml" , cwd ) ) ;
41- const { stdout } = await execa ( cmd , { input } ) ;
42- expect ( stdout ) . toBe ( expected ) ;
43- } , 30000 ) ;
12+ test (
13+ "GitHub API" ,
14+ async ( ) => {
15+ const expected = fs . readFileSync ( new URL ( "./examples/github-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
16+ const { stdout } = await execa ( cmd , [ "./examples/github-api.yaml" ] , { cwd } ) ;
17+ expect ( stdout ) . toBe ( expected ) ;
18+ } ,
19+ TIMEOUT
20+ ) ;
21+ test (
22+ "GitHub API (next)" ,
23+ async ( ) => {
24+ const expected = fs . readFileSync ( new URL ( "./examples/github-api-next.ts" , cwd ) , "utf8" ) . trim ( ) ;
25+ const { stdout } = await execa ( cmd , [ "./examples/github-api-next.yaml" ] , { cwd } ) ;
26+ expect ( stdout ) . toBe ( expected ) ;
27+ } ,
28+ TIMEOUT
29+ ) ;
30+ test (
31+ "Octokit GHES 3.6 Diff to API" ,
32+ async ( ) => {
33+ const expected = fs . readFileSync ( new URL ( "./examples/octokit-ghes-3.6-diff-to-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
34+ const { stdout } = await execa ( cmd , [ "./examples/octokit-ghes-3.6-diff-to-api.json" ] , { cwd } ) ;
35+ expect ( stdout ) . toBe ( expected ) ;
36+ } ,
37+ TIMEOUT
38+ ) ;
39+ test (
40+ "Stripe API" ,
41+ async ( ) => {
42+ const expected = fs . readFileSync ( new URL ( "./examples/stripe-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
43+ const { stdout } = await execa ( cmd , [ "./examples/stripe-api.yaml" ] , { cwd } ) ;
44+ expect ( stdout ) . toBe ( expected ) ;
45+ } ,
46+ TIMEOUT
47+ ) ;
48+ test (
49+ "DigitalOcean API (remote $refs)" ,
50+ async ( ) => {
51+ const expected = fs . readFileSync ( new URL ( "./examples/digital-ocean-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
52+ const { stdout } = await execa ( cmd , [ "./examples/digital-ocean-api/DigitalOcean-public.v2.yaml" ] , {
53+ cwd,
54+ } ) ;
55+ expect ( stdout ) . toBe ( expected ) ;
56+ } ,
57+ TIMEOUT
58+ ) ;
59+ test (
60+ "stdin" ,
61+ async ( ) => {
62+ const expected = fs . readFileSync ( new URL ( "./examples/stripe-api.ts" , cwd ) , "utf8" ) . trim ( ) ;
63+ const input = fs . readFileSync ( new URL ( "./examples/stripe-api.yaml" , cwd ) ) ;
64+ const { stdout } = await execa ( cmd , { input } ) ;
65+ expect ( stdout ) . toBe ( expected ) ;
66+ } ,
67+ TIMEOUT
68+ ) ;
4469 } ) ;
4570
4671 describe ( "flags" , ( ) => {
0 commit comments