Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #97 from readmeio/bug/fix-manual-oauth-api-key
Browse files Browse the repository at this point in the history
Fix issue where api key couldnt be set manually for oauth
  • Loading branch information
uppal101 authored Feb 6, 2018
2 parents 4010334 + aafe44a commit 052df6e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/api-explorer/__tests__/SecurityInput.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ describe('oauth2', () => {
securityInput.find('input[type="text"]').simulate('change');

expect(onChange.mock.calls[0][0]).toEqual({ 'test-auth': '1234' });

expect(securityInput.find('input[type="text"]').instance().value).toEqual('1234');

securityInput.find('input[type="text"]').instance().value += '56';
securityInput.find('input[type="text"]').simulate('change');
expect(onChange.mock.calls[1][0]).toEqual({ 'test-auth': '123456' });
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/api-explorer/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ describe('apiKey', () => {
expect(explorer.state('apiKey')).toBe(apiKey);
});

it('should default to empty string', () => {
it('should default to undefined', () => {
const explorer = shallow(<ApiExplorer {...props} />);

expect(explorer.state('apiKey')).toBe('');
expect(explorer.state('apiKey')).toBe(undefined);
});
});
2 changes: 1 addition & 1 deletion packages/api-explorer/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ApiExplorer extends React.Component {
const userData = Cookie.getJSON('user_data');
return userData.keys.api_key;
} catch (e) {
return '';
return undefined;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/api-explorer/src/security-input-types/Oauth2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Oauth2.propTypes = {
};

Oauth2.defaultProps = {
apiKey: '',
apiKey: undefined,
authInputRef: () => {},
};

Expand Down

0 comments on commit 052df6e

Please sign in to comment.