Skip to content
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

fix: Update jest to 30-alpha to support prettier 3 in snapshot updates #234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
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
Loading