-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #585 from powerful23/cognito-hosted-ui
Cognito hosted ui
- Loading branch information
Showing
23 changed files
with
1,578 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/aws-amplify-react/__tests__/Auth/Provider/__snapshots__/withOAuth-test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`withOAuth test render test render correctly 1`] = ` | ||
<MockComp | ||
OAuthSignIn={[Function]} | ||
/> | ||
`; | ||
|
||
exports[`withOAuth test render test render correctly with button 1`] = ` | ||
<Button | ||
OAuthSignIn={[Function]} | ||
/> | ||
`; |
54 changes: 54 additions & 0 deletions
54
packages/aws-amplify-react/__tests__/Auth/Provider/withOAuth-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { Component } from 'react'; | ||
import withOAuth, { OAuthButton } from '../../../src/Auth/Provider/withOAuth'; | ||
import { SignInButton, Button } from '../../../src/AmplifyUI'; | ||
import { Auth } from 'aws-amplify'; | ||
|
||
describe('withOAuth test', () => { | ||
describe('render test', () => { | ||
test('render correctly', () => { | ||
const MockComp = class extends Component { | ||
render() { | ||
return <div />; | ||
} | ||
} | ||
|
||
const Comp = withOAuth(MockComp); | ||
const wrapper = shallow(<Comp/>); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
test('render correctly with button', () => { | ||
const wrapper = shallow(<OAuthButton/>); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
describe('signIn test', () => { | ||
test('happy case with connected response', () => { | ||
const MockComp = class extends Component { | ||
render() { | ||
return <div />; | ||
} | ||
} | ||
|
||
const spyon = jest.spyOn(Auth, 'configure').mockImplementation(() => { | ||
return { | ||
oauth: { | ||
domain: 'domain', | ||
redirectSignIn: 'redirectUriSignIn', | ||
redirectSignOut: 'redirectUriSignOut', | ||
responseType: 'responseType' | ||
}, | ||
userPoolWebClientId: 'userPoolWebClientId' | ||
} | ||
}) | ||
const Comp = withOAuth(MockComp); | ||
const wrapper = shallow(<Comp/>); | ||
const comp = wrapper.instance(); | ||
|
||
comp.signIn(); | ||
|
||
spyon.mockClear(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.