Skip to content

Commit

Permalink
chore: updated all dep and fixed all vulnerabilities (#241)
Browse files Browse the repository at this point in the history
* updated all dep and fixed all vulnerabilities

* removed template.test.ts so tests pass. there is no template.ts file at all...

* udpate @types/jest to ^29.5.12

* update test files

* udpate just to 30.0.0-alpha.1 supporting prettier 3.0.0 now

---------

Co-authored-by: Fabian Althaus <[email protected]>
  • Loading branch information
el-j and Fabian Althaus authored Apr 3, 2024
1 parent 9c9af24 commit cd25794
Show file tree
Hide file tree
Showing 20 changed files with 23,353 additions and 18,463 deletions.
98 changes: 49 additions & 49 deletions cli/src/core/generateConfigProperty.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ describe("generateConfigProperty", () => {
});

expect(print(config)).toMatchInlineSnapshot(`
"foo: {
from: {
source: \\"file\\",
relativePath: \\"specs.yaml\\"
},
outputDir: \\"specs\\",
to: async (context) => {
await generateSchemaTypes(context, {
filenamePrefix: \\"foo\\"
});
}
}"
"foo: {
from: {
source: "file",
relativePath: "specs.yaml"
},
outputDir: "specs",
to: async (context) => {
await generateSchemaTypes(context, {
filenamePrefix: "foo"
});
}
}"
`);
});

Expand All @@ -45,23 +45,23 @@ describe("generateConfigProperty", () => {
});

expect(print(config)).toMatchInlineSnapshot(`
"foo: {
from: {
source: \\"file\\",
relativePath: \\"specs.yaml\\"
},
outputDir: \\"specs\\",
to: async (context) => {
const filenamePrefix = \\"foo\\";
const { schemasFiles } = await generateSchemaTypes(context, {
filenamePrefix
});
await generateReactQueryComponents(context, {
filenamePrefix,
schemasFiles
});
}
}"
"foo: {
from: {
source: "file",
relativePath: "specs.yaml"
},
outputDir: "specs",
to: async (context) => {
const filenamePrefix = "foo";
const { schemasFiles } = await generateSchemaTypes(context, {
filenamePrefix
});
await generateReactQueryComponents(context, {
filenamePrefix,
schemasFiles
});
}
}"
`);
});

Expand All @@ -82,26 +82,26 @@ describe("generateConfigProperty", () => {
});

expect(print(config)).toMatchInlineSnapshot(`
"foo: {
from: {
source: \\"github\\",
ref: \\"main\\",
owner: \\"fabien0102\\",
repository: \\"openapi-codegen\\",
specPath: \\"examples/petstore.json\\"
},
outputDir: \\"specs\\",
to: async (context) => {
const filenamePrefix = \\"foo\\";
const { schemasFiles } = await generateSchemaTypes(context, {
filenamePrefix
});
await generateFetchers(context, {
filenamePrefix,
schemasFiles
});
}
}"
"foo: {
from: {
source: "github",
ref: "main",
owner: "fabien0102",
repository: "openapi-codegen",
specPath: "examples/petstore.json"
},
outputDir: "specs",
to: async (context) => {
const filenamePrefix = "foo";
const { schemasFiles } = await generateSchemaTypes(context, {
filenamePrefix
});
await generateFetchers(context, {
filenamePrefix,
schemasFiles
});
}
}"
`);
});
});
Expand Down
102 changes: 51 additions & 51 deletions cli/src/core/getOpenAPISourceFile.file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ describe("getOpenAPISourceFile (source = file)", () => {

expect(format).toBe("yaml");
expect(text).toMatchInlineSnapshot(`
"openapi: \\"3.0.2\\"
info:
title: API Title
version: \\"1.0\\"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
\\"200\\":
description: OK
"
"openapi: "3.0.2"
info:
title: API Title
version: "1.0"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
"200":
description: OK
"
`);
});

Expand All @@ -33,19 +33,19 @@ describe("getOpenAPISourceFile (source = file)", () => {

expect(format).toBe("yaml");
expect(text).toMatchInlineSnapshot(`
"openapi: \\"3.0.2\\"
info:
title: API Title
version: \\"1.0\\"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
\\"200\\":
description: OK
"
"openapi: "3.0.2"
info:
title: API Title
version: "1.0"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
"200":
description: OK
"
`);
});

Expand All @@ -57,30 +57,30 @@ describe("getOpenAPISourceFile (source = file)", () => {

expect(format).toBe("json");
expect(text).toMatchInlineSnapshot(`
"{
\\"openapi\\": \\"3.0.2\\",
\\"info\\": {
\\"title\\": \\"API Title\\",
\\"version\\": \\"1.0\\"
},
\\"servers\\": [
{
\\"url\\": \\"https://api.server.test/v1\\"
}
],
\\"paths\\": {
\\"/test\\": {
\\"get\\": {
\\"responses\\": {
\\"200\\": {
\\"description\\": \\"OK\\"
}
}
}
}
}
}
"
"{
"openapi": "3.0.2",
"info": {
"title": "API Title",
"version": "1.0"
},
"servers": [
{
"url": "https://api.server.test/v1"
}
],
"paths": {
"/test": {
"get": {
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
}
"
`);
});

Expand All @@ -93,7 +93,7 @@ describe("getOpenAPISourceFile (source = file)", () => {
fail("should throw an error");
} catch (e) {
expect(e).toMatchInlineSnapshot(
`[Error: "yolo" extension file is not supported!]`
`[Error: "yolo" extension file is not supported!]`,
);
}
});
Expand Down
78 changes: 39 additions & 39 deletions cli/src/core/getOpenAPISourceFile.url.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import nock from "nock";
describe("getOpenAPISourceFile (source = url)", () => {
it("should retrieve a json file specs", async () => {
nock(
"https://github.com/fabien0102/openapi-codegen/blob/main/cli/examples/petstore.json"
"https://github.com/fabien0102/openapi-codegen/blob/main/cli/examples/petstore.json",
)
.get("")
.replyWithFile(200, "cli/src/fixtures/spec.json");
Expand All @@ -17,36 +17,36 @@ describe("getOpenAPISourceFile (source = url)", () => {

expect(format).toBe("json");
expect(text).toMatchInlineSnapshot(`
"{
\\"openapi\\": \\"3.0.2\\",
\\"info\\": {
\\"title\\": \\"API Title\\",
\\"version\\": \\"1.0\\"
},
\\"servers\\": [
{
\\"url\\": \\"https://api.server.test/v1\\"
}
],
\\"paths\\": {
\\"/test\\": {
\\"get\\": {
\\"responses\\": {
\\"200\\": {
\\"description\\": \\"OK\\"
}
}
}
}
}
}
"
"{
"openapi": "3.0.2",
"info": {
"title": "API Title",
"version": "1.0"
},
"servers": [
{
"url": "https://api.server.test/v1"
}
],
"paths": {
"/test": {
"get": {
"responses": {
"200": {
"description": "OK"
}
}
}
}
}
}
"
`);
});

it("should guess the format with search params", async () => {
nock(
"https://github.com/fabien0102/openapi-codegen/blob/main/cli/examples/petstore.yaml"
"https://github.com/fabien0102/openapi-codegen/blob/main/cli/examples/petstore.yaml",
)
.get("?key=secret")
.replyWithFile(200, "cli/src/fixtures/spec.yaml");
Expand All @@ -59,19 +59,19 @@ describe("getOpenAPISourceFile (source = url)", () => {

expect(format).toBe("yaml");
expect(text).toMatchInlineSnapshot(`
"openapi: \\"3.0.2\\"
info:
title: API Title
version: \\"1.0\\"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
\\"200\\":
description: OK
"
"openapi: "3.0.2"
info:
title: API Title
version: "1.0"
servers:
- url: https://api.server.test/v1
paths:
/test:
get:
responses:
"200":
description: OK
"
`);
});
});
Loading

0 comments on commit cd25794

Please sign in to comment.