|
| 1 | +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html |
| 2 | + |
| 3 | +exports[`rdme openapi upload > flag error handling > should throw if an error if both \`--version\` and \`--useSpecVersion\` flags are passed 1`] = ` |
| 4 | +{ |
| 5 | + "error": [Error: The following error occurred: |
| 6 | + --version=1.0.0 cannot also be provided when using --useSpecVersion |
| 7 | +See more help with --help], |
| 8 | + "stderr": "", |
| 9 | + "stdout": "", |
| 10 | +} |
| 11 | +`; |
| 12 | + |
| 13 | +exports[`rdme openapi upload > given that the API definition is a URL > should create a new API definition in ReadMe 1`] = ` |
| 14 | +{ |
| 15 | + "result": { |
| 16 | + "status": "done", |
| 17 | + "uri": "/versions/1.0.0/apis/openapi.json", |
| 18 | + }, |
| 19 | + "stderr": "- Validating the API definition located at https://example.com/openapi.json... |
| 20 | +- Creating your API definition to ReadMe... |
| 21 | +✔ Creating your API definition to ReadMe... done! |
| 22 | +", |
| 23 | + "stdout": "🚀 Your API definition (openapi.json) was successfully created in ReadMe! |
| 24 | +", |
| 25 | +} |
| 26 | +`; |
| 27 | + |
| 28 | +exports[`rdme openapi upload > given that the API definition is a URL > should handle issues fetching from the URL 1`] = ` |
| 29 | +{ |
| 30 | + "error": [Error: Unknown file detected.], |
| 31 | + "stderr": "- Validating the API definition located at https://example.com/openapi.json... |
| 32 | +✖ Validating the API definition located at https://example.com/openapi.json... |
| 33 | +", |
| 34 | + "stdout": "", |
| 35 | +} |
| 36 | +`; |
| 37 | + |
| 38 | +exports[`rdme openapi upload > given that the API definition is a URL > should update an existing API definition in ReadMe 1`] = ` |
| 39 | +{ |
| 40 | + "result": { |
| 41 | + "status": "done", |
| 42 | + "uri": "/versions/1.0.0/apis/openapi.json", |
| 43 | + }, |
| 44 | + "stderr": "- Validating the API definition located at https://example.com/openapi.json... |
| 45 | +- Updating your API definition to ReadMe... |
| 46 | +✔ Updating your API definition to ReadMe... done! |
| 47 | +", |
| 48 | + "stdout": "🚀 Your API definition (openapi.json) was successfully updated in ReadMe! |
| 49 | +", |
| 50 | +} |
| 51 | +`; |
| 52 | + |
| 53 | +exports[`rdme openapi upload > given that the API definition is a local file > and the \`--slug\` flag is passed > should handle a slug with a valid but mismatching file extension 1`] = ` |
| 54 | +{ |
| 55 | + "error": [Error: Please provide a valid file extension that matches the extension on the file you provided. Must be \`.json\`, \`.yaml\`, or \`.yml\`.], |
| 56 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 57 | + › Warning: The slug of your API Definition will be set to |
| 58 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 59 | + › slug is not visible to your end users. To set this slug to something else, |
| 60 | + › use the \`--slug\` flag. |
| 61 | +", |
| 62 | + "stdout": "", |
| 63 | +} |
| 64 | +`; |
| 65 | +
|
| 66 | +exports[`rdme openapi upload > given that the API definition is a local file > and the \`--slug\` flag is passed > should handle a slug with an invalid file extension 1`] = ` |
| 67 | +{ |
| 68 | + "error": [Error: Please provide a valid file extension that matches the extension on the file you provided. Must be \`.json\`, \`.yaml\`, or \`.yml\`.], |
| 69 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 70 | + › Warning: The slug of your API Definition will be set to |
| 71 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 72 | + › slug is not visible to your end users. To set this slug to something else, |
| 73 | + › use the \`--slug\` flag. |
| 74 | +", |
| 75 | + "stdout": "", |
| 76 | +} |
| 77 | +`; |
| 78 | +
|
| 79 | +exports[`rdme openapi upload > given that the API definition is a local file > and the \`--slug\` flag is passed > should use the provided slug (includes file extension) as the filename 1`] = ` |
| 80 | +{ |
| 81 | + "result": { |
| 82 | + "status": "done", |
| 83 | + "uri": "/versions/1.0.0/apis/custom-slug.json", |
| 84 | + }, |
| 85 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 86 | + › Warning: The slug of your API Definition will be set to |
| 87 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 88 | + › slug is not visible to your end users. To set this slug to something else, |
| 89 | + › use the \`--slug\` flag. |
| 90 | +- Creating your API definition to ReadMe... |
| 91 | +✔ Creating your API definition to ReadMe... done! |
| 92 | +", |
| 93 | + "stdout": "🚀 Your API definition (custom-slug.json) was successfully created in ReadMe! |
| 94 | +", |
| 95 | +} |
| 96 | +`; |
| 97 | +
|
| 98 | +exports[`rdme openapi upload > given that the API definition is a local file > and the \`--slug\` flag is passed > should use the provided slug (no file extension) as the filename 1`] = ` |
| 99 | +{ |
| 100 | + "result": { |
| 101 | + "status": "done", |
| 102 | + "uri": "/versions/1.0.0/apis/custom-slug.json", |
| 103 | + }, |
| 104 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 105 | + › Warning: The slug of your API Definition will be set to |
| 106 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 107 | + › slug is not visible to your end users. To set this slug to something else, |
| 108 | + › use the \`--slug\` flag. |
| 109 | +- Creating your API definition to ReadMe... |
| 110 | +✔ Creating your API definition to ReadMe... done! |
| 111 | +", |
| 112 | + "stdout": "🚀 Your API definition (custom-slug.json) was successfully created in ReadMe! |
| 113 | +", |
| 114 | +} |
| 115 | +`; |
| 116 | +
|
| 117 | +exports[`rdme openapi upload > given that the API definition is a local file > and the command is being run in a CI environment > should overwrite an existing API definition without asking for confirmation 1`] = ` |
| 118 | +{ |
| 119 | + "result": { |
| 120 | + "status": "done", |
| 121 | + "uri": "/versions/1.0.0/apis/__tests____fixtures__petstore-simple-weird-version.json", |
| 122 | + }, |
| 123 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 124 | + › Warning: The slug of your API Definition will be set to |
| 125 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 126 | + › slug is not visible to your end users. To set this slug to something else, |
| 127 | + › use the \`--slug\` flag. |
| 128 | +- Updating your API definition to ReadMe... |
| 129 | +✔ Updating your API definition to ReadMe... done! |
| 130 | +", |
| 131 | + "stdout": "🚀 Your API definition (__tests____fixtures__petstore-simple-weird-version.json) was successfully updated in ReadMe! |
| 132 | +", |
| 133 | +} |
| 134 | +`; |
| 135 | +
|
| 136 | +exports[`rdme openapi upload > given that the API definition is a local file > and the upload status initially is a pending state > should poll the API and handle timeouts 1`] = ` |
| 137 | +{ |
| 138 | + "error": [Error: Sorry, this upload timed out. Please try again later.], |
| 139 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 140 | + › Warning: The slug of your API Definition will be set to |
| 141 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 142 | + › slug is not visible to your end users. To set this slug to something else, |
| 143 | + › use the \`--slug\` flag. |
| 144 | +- Creating your API definition to ReadMe... |
| 145 | +", |
| 146 | + "stdout": "", |
| 147 | +} |
| 148 | +`; |
| 149 | +
|
| 150 | +exports[`rdme openapi upload > given that the API definition is a local file > and the upload status initially is a pending state > should poll the API once and handle a failure state with a 4xx 1`] = ` |
| 151 | +{ |
| 152 | + "error": [Error: The ReadMe API responded with an unexpected error. Please try again and if this issue persists, get in touch with us at support@readme.io.], |
| 153 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 154 | + › Warning: The slug of your API Definition will be set to |
| 155 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 156 | + › slug is not visible to your end users. To set this slug to something else, |
| 157 | + › use the \`--slug\` flag. |
| 158 | +- Creating your API definition to ReadMe... |
| 159 | +", |
| 160 | + "stdout": "", |
| 161 | +} |
| 162 | +`; |
| 163 | +
|
| 164 | +exports[`rdme openapi upload > given that the API definition is a local file > and the upload status initially is a pending state > should poll the API once and handle an unexpected state with a 2xx 1`] = ` |
| 165 | +{ |
| 166 | + "error": [Error: Your API definition upload failed with an unexpected error. Please get in touch with us at support@readme.io.], |
| 167 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 168 | + › Warning: The slug of your API Definition will be set to |
| 169 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 170 | + › slug is not visible to your end users. To set this slug to something else, |
| 171 | + › use the \`--slug\` flag. |
| 172 | +- Creating your API definition to ReadMe... |
| 173 | +✖ Creating your API definition to ReadMe... uploaded but not yet processed by ReadMe. Polling for completion... |
| 174 | +", |
| 175 | + "stdout": "", |
| 176 | +} |
| 177 | +`; |
| 178 | +
|
| 179 | +exports[`rdme openapi upload > given that the API definition is a local file > and the upload status initially is a pending state > should poll the API until the upload is complete 1`] = ` |
| 180 | +{ |
| 181 | + "result": { |
| 182 | + "status": "done", |
| 183 | + "uri": "/versions/1.0.0/apis/__tests____fixtures__petstore-simple-weird-version.json", |
| 184 | + }, |
| 185 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 186 | + › Warning: The slug of your API Definition will be set to |
| 187 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 188 | + › slug is not visible to your end users. To set this slug to something else, |
| 189 | + › use the \`--slug\` flag. |
| 190 | +- Creating your API definition to ReadMe... |
| 191 | +✔ Creating your API definition to ReadMe... uploaded but not yet processed by ReadMe. Polling for completion... done! |
| 192 | +", |
| 193 | + "stdout": "🚀 Your API definition (__tests____fixtures__petstore-simple-weird-version.json) was successfully created in ReadMe! |
| 194 | +", |
| 195 | +} |
| 196 | +`; |
| 197 | +
|
| 198 | +exports[`rdme openapi upload > given that the API definition is a local file > given that the \`--version\` flag is not set > should default to the \`stable\` version 1`] = ` |
| 199 | +{ |
| 200 | + "result": { |
| 201 | + "status": "done", |
| 202 | + "uri": "/versions/stable/apis/__tests____fixtures__petstore-simple-weird-version.json", |
| 203 | + }, |
| 204 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 205 | + › Warning: The slug of your API Definition will be set to |
| 206 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 207 | + › slug is not visible to your end users. To set this slug to something else, |
| 208 | + › use the \`--slug\` flag. |
| 209 | +- Creating your API definition to ReadMe... |
| 210 | +✔ Creating your API definition to ReadMe... done! |
| 211 | +", |
| 212 | + "stdout": "🚀 Your API definition (__tests____fixtures__petstore-simple-weird-version.json) was successfully created in ReadMe! |
| 213 | +", |
| 214 | +} |
| 215 | +`; |
| 216 | +
|
| 217 | +exports[`rdme openapi upload > given that the API definition is a local file > given that the \`--version\` flag is not set > should use the version from the spec file if --\`useSpecVersion\` is passed 1`] = ` |
| 218 | +{ |
| 219 | + "result": { |
| 220 | + "status": "done", |
| 221 | + "uri": "/versions/1.2.3/apis/__tests____fixtures__petstore-simple-weird-version.json", |
| 222 | + }, |
| 223 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 224 | + › Warning: The slug of your API Definition will be set to |
| 225 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 226 | + › slug is not visible to your end users. To set this slug to something else, |
| 227 | + › use the \`--slug\` flag. |
| 228 | +- Creating your API definition to ReadMe... |
| 229 | +✔ Creating your API definition to ReadMe... done! |
| 230 | +", |
| 231 | + "stdout": "🚀 Your API definition (__tests____fixtures__petstore-simple-weird-version.json) was successfully created in ReadMe! |
| 232 | +", |
| 233 | +} |
| 234 | +`; |
| 235 | +
|
| 236 | +exports[`rdme openapi upload > given that the API definition is a local file > should create a new JSON API definition in ReadMe 1`] = ` |
| 237 | +{ |
| 238 | + "result": { |
| 239 | + "status": "done", |
| 240 | + "uri": "/versions/1.0.0/apis/__tests____fixtures__petstore-simple-weird-version.json", |
| 241 | + }, |
| 242 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 243 | + › Warning: The slug of your API Definition will be set to |
| 244 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 245 | + › slug is not visible to your end users. To set this slug to something else, |
| 246 | + › use the \`--slug\` flag. |
| 247 | +- Creating your API definition to ReadMe... |
| 248 | +✔ Creating your API definition to ReadMe... done! |
| 249 | +", |
| 250 | + "stdout": "🚀 Your API definition (__tests____fixtures__petstore-simple-weird-version.json) was successfully created in ReadMe! |
| 251 | +", |
| 252 | +} |
| 253 | +`; |
| 254 | +
|
| 255 | +exports[`rdme openapi upload > given that the API definition is a local file > should create a new YAML API definition in ReadMe 1`] = ` |
| 256 | +{ |
| 257 | + "result": { |
| 258 | + "status": "done", |
| 259 | + "uri": "/versions/1.0.0/apis/__tests____fixtures__postmanpetstore.collection.yaml", |
| 260 | + }, |
| 261 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/postman/petstore.collection.yaml... |
| 262 | + › Warning: The slug of your API Definition will be set to |
| 263 | + › __tests____fixtures__postmanpetstore.collection.yaml in ReadMe. This slug |
| 264 | + › is not visible to your end users. To set this slug to something else, use |
| 265 | + › the \`--slug\` flag. |
| 266 | +- Creating your API definition to ReadMe... |
| 267 | +✔ Creating your API definition to ReadMe... done! |
| 268 | +", |
| 269 | + "stdout": "🚀 Your API definition (__tests____fixtures__postmanpetstore.collection.yaml) was successfully created in ReadMe! |
| 270 | +", |
| 271 | +} |
| 272 | +`; |
| 273 | +
|
| 274 | +exports[`rdme openapi upload > given that the API definition is a local file > should handle upload failures 1`] = ` |
| 275 | +{ |
| 276 | + "error": [Error: Your API definition upload failed with an unexpected error. Please get in touch with us at support@readme.io.], |
| 277 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 278 | + › Warning: The slug of your API Definition will be set to |
| 279 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 280 | + › slug is not visible to your end users. To set this slug to something else, |
| 281 | + › use the \`--slug\` flag. |
| 282 | +- Creating your API definition to ReadMe... |
| 283 | +✖ Creating your API definition to ReadMe... |
| 284 | +", |
| 285 | + "stdout": "", |
| 286 | +} |
| 287 | +`; |
| 288 | +
|
| 289 | +exports[`rdme openapi upload > given that the API definition is a local file > should update an existing API definition in ReadMe 1`] = ` |
| 290 | +{ |
| 291 | + "result": { |
| 292 | + "status": "done", |
| 293 | + "uri": "/versions/1.0.0/apis/__tests____fixtures__petstore-simple-weird-version.json", |
| 294 | + }, |
| 295 | + "stderr": "- Validating the API definition located at __tests__/__fixtures__/petstore-simple-weird-version.json... |
| 296 | + › Warning: The slug of your API Definition will be set to |
| 297 | + › __tests____fixtures__petstore-simple-weird-version.json in ReadMe. This |
| 298 | + › slug is not visible to your end users. To set this slug to something else, |
| 299 | + › use the \`--slug\` flag. |
| 300 | +- Updating your API definition to ReadMe... |
| 301 | +✔ Updating your API definition to ReadMe... done! |
| 302 | +", |
| 303 | + "stdout": "🚀 Your API definition (__tests____fixtures__petstore-simple-weird-version.json) was successfully updated in ReadMe! |
| 304 | +", |
| 305 | +} |
| 306 | +`; |
0 commit comments