Skip to content

Commit

Permalink
Fixed ref
Browse files Browse the repository at this point in the history
  • Loading branch information
gratcliff committed Jul 18, 2019
1 parent 996a4c1 commit 383feb5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,13 @@ exports.run = async function({ args, opts }) {
// If the user didn't supply a specification, let's try to locate what they've got, and upload
// that. If they don't have any, let's let the user know how they can get one going.
return new Promise(async (resolve, reject) => {
let foundFile;
['swagger.json', 'swagger.yaml', 'openapi.json', 'openapi.yaml'].forEach(file => {
if (!fs.existsSync(file)) {
return;
}

console.log(`We found ${file} and are attempting to upload it.`.yellow);
resolve(callApi(foundFile, selectedVersion));
resolve(callApi(file, selectedVersion));
});

reject(
Expand Down
5 changes: 1 addition & 4 deletions test/swagger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ describe('swagger command', () => {
});

it('should error if no file was provided or able to be discovered', () => {
expect(swagger([], { key })).rejects.toThrow(
"We couldn't find a Swagger or OpenAPI file.\n\n" +
'Run `rdme swagger ./path/to/file` to upload an existing file or `rdme oas init` to create a fresh one!',
);
expect(swagger([], { key })).rejects.toThrowError();
});
});

0 comments on commit 383feb5

Please sign in to comment.