Skip to content
Merged
134 changes: 131 additions & 3 deletions __tests__/commands/openapi/__snapshots__/upload.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ exports[`rdme openapi upload > given that the "--legacy-id" flag is passed > sho
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > and the \`--slug\` flag is passed > should create a new API definition in ReadMe with a custom slug with YAML file extension where URL has no path and the file is YAML 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/custom-slug.yml",
},
"stderr": "- Validating the API definition located at https://example.com...
› Warning: Support for Postman collections is currently experimental.
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
"stdout": "🚀 Your API definition (custom-slug.yml) was successfully created in ReadMe!
",
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > and the \`--slug\` flag is passed > should create a new API definition in ReadMe with the specified slug 1`] = `
{
"result": {
Expand All @@ -80,13 +96,29 @@ exports[`rdme openapi upload > given that the API definition is a URL > and the
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > and the \`--slug\` flag is passed > should create a new API definition in ReadMe with the specified slug where URL has no path 1`] = `
exports[`rdme openapi upload > given that the API definition is a URL > and the \`--slug\` flag is passed > should create a new API definition in ReadMe with the specified slug where URL has no path and the file is JSON 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/custom-slug.json",
},
"stderr": "- Validating the API definition located at https://example.com...
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
"stdout": "🚀 Your API definition (custom-slug.json) was successfully created in ReadMe!
",
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > and the \`--slug\` flag is passed > should create a new API definition in ReadMe with the specified slug where URL has no path and the file is YAML 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/custom-slug.json.json",
"uri": "/branches/1.0.0/apis/custom-slug.json",
},
"stderr": "- Validating the API definition located at https://example.com...
› Warning: Support for Postman collections is currently experimental.
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
Expand All @@ -99,7 +131,7 @@ exports[`rdme openapi upload > given that the API definition is a URL > and the
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/custom-slug.json.json",
"uri": "/branches/1.0.0/apis/custom-slug.json",
},
"stderr": "- Validating the API definition located at https://example.com/openapi.json?somequery=true...
- Creating your API definition to ReadMe...
Expand All @@ -117,6 +149,81 @@ exports[`rdme openapi upload > given that the API definition is a URL > should c
"uri": "/branches/1.0.0/apis/openapi.json",
},
"stderr": "- Validating the API definition located at https://example.com/openapi.json...
› Warning: The slug of your API Definition will be set to openapi.json in
› ReadMe. This slug is not visible to your end users. To set this slug to
› something else, use the \`--slug\` flag.
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
"stdout": "🚀 Your API definition (openapi.json) was successfully created in ReadMe!
",
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > should create a new API definition in ReadMe if there is no file extension and the file is JSON 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/no-extension.json",
},
"stderr": "- Validating the API definition located at https://example.com/no-extension...
› Warning: The slug of your API Definition will be set to no-extension.json
› in ReadMe. This slug is not visible to your end users. To set this slug to
› something else, use the \`--slug\` flag.
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
"stdout": "🚀 Your API definition (no-extension.json) was successfully created in ReadMe!
",
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > should create a new API definition in ReadMe if there is no file extension and the file is YAML 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/no-extension.json",
},
"stderr": "- Validating the API definition located at https://example.com/no-extension...
› Warning: Support for Postman collections is currently experimental.
› Warning: The slug of your API Definition will be set to no-extension.json
› in ReadMe. This slug is not visible to your end users. To set this slug to
› something else, use the \`--slug\` flag.
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
"stdout": "🚀 Your API definition (no-extension.json) was successfully created in ReadMe!
",
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > should create a new API definition in ReadMe if there is no path and the file is JSON 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/openapi.json",
},
"stderr": "- Validating the API definition located at https://example.com...
› Warning: No filename could be inferred from the provided URL, so the slug
› will default to openapi.json. To set a custom slug, use the \`--slug\` flag.
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
"stdout": "🚀 Your API definition (openapi.json) was successfully created in ReadMe!
",
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > should create a new API definition in ReadMe if there is no path and the file is YAML 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/openapi.json",
},
"stderr": "- Validating the API definition located at https://example.com...
› Warning: Support for Postman collections is currently experimental.
› Warning: No filename could be inferred from the provided URL, so the slug
› will default to openapi.json. To set a custom slug, use the \`--slug\` flag.
- Creating your API definition to ReadMe...
✔ Creating your API definition to ReadMe... done!
",
Expand All @@ -142,6 +249,9 @@ exports[`rdme openapi upload > given that the API definition is a URL > should u
"uri": "/branches/1.0.0/apis/openapi.json",
},
"stderr": "- Validating the API definition located at https://example.com/openapi.json...
› Warning: The slug of your API Definition will be set to openapi.json in
› ReadMe. This slug is not visible to your end users. To set this slug to
› something else, use the \`--slug\` flag.
- Updating your API definition to ReadMe...
✔ Updating your API definition to ReadMe... done!
",
Expand All @@ -150,6 +260,24 @@ exports[`rdme openapi upload > given that the API definition is a URL > should u
}
`;

exports[`rdme openapi upload > given that the API definition is a URL > should update an existing API definition in ReadMe and the URL lacks an extension 1`] = `
{
"result": {
"status": "done",
"uri": "/branches/1.0.0/apis/openapi.json",
},
"stderr": "- Validating the API definition located at https://example.com/no-extension...
› Warning: The slug of your API Definition will be set to no-extension.json
› in ReadMe. This slug is not visible to your end users. To set this slug to
› something else, use the \`--slug\` flag.
- Updating your API definition to ReadMe...
✔ Updating your API definition to ReadMe... done!
",
"stdout": "🚀 Your API definition (no-extension.json) was successfully updated in ReadMe!
",
}
`;

exports[`rdme openapi upload > given that the API definition is a local file > and the \`--slug\` flag is passed > should emit a warning if an object ID is passed and no legacy match is found 1`] = `
{
"result": {
Expand Down
Loading
Loading