Skip to content

Commit

Permalink
test: flag test
Browse files Browse the repository at this point in the history
  • Loading branch information
kanadgupta committed Dec 10, 2024
1 parent 0269d73 commit 2ad046a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions __tests__/commands/openapi/upload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ describe('rdme openapi upload', () => {
nock.cleanAll();
});

describe('flag error handling', () => {
it('should throw if an error if both `--version` and `--useSpecVersion` flags are passed', async () => {
const result = await run(['--useSpecVersion', '--version', version, filename, '--key', key]);
expect(result.error.message).toContain('--version cannot also be provided when using --useSpecVersion');
});

it('should throw if an error if neither version flag is passed', async () => {
const result = await run([filename, '--key', key]);
expect(result.error.message).toContain(
'Exactly one of the following must be provided: --useSpecVersion, --version',
);
});
});

describe('given that the API definition is a local file', () => {
it('should create a new API definition in ReadMe', async () => {
const mock = getAPIv2Mock({ authorization: `Bearer ${key}` })
Expand Down

0 comments on commit 2ad046a

Please sign in to comment.