-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are there any available instructions for use? #1
Comments
The library is quite simple and is meant to be a drop-in replacement for Amplify Auth as you would use it for Cognito User Pool authorization. It allows you to use your front end running with a server-less-offline back end. An example of it being used is here: https://github.com/fourTheorem/slic-starter/blob/master/frontend/src/auth-provider.js Associated redux action creators are here: https://github.com/fourTheorem/slic-starter/blob/master/frontend/src/actions/auth.js Hope this helps. |
I get: "Auth.currentAuthenticatedUser is not a function" error. I see |
Correct me if I am wrong @eoinsha, however, if using jest you'd do something like this; import mockAuth from 'mock-amplify-auth'
jest.mock('@aws-amplify/auth', mockAuth);
test('should', () => {
// ...
}) If you want to extend it for currentAuthenticatedUser (we need to mock import mockAuth from 'mock-amplify-auth';
// build your mocks - you could use `mockAuth` if you need access to internal state.
// personally, I only need jest.fn()
const mockMissingAuthFunctions = {
completeNewPassword: jest.fn(),
currentAuthenticatedUser: jest.fn()
}
jest.mock('@aws-amplify/auth', () => ({
...mockAuth,
...mockMissingAuthFunctions
}))
test('should', () => {
// ...
}) |
Here's how I did it using Jest import mockAuth from 'mock-amplify-auth';
jest.mock('aws-amplify', () => ({
Auth: {
...mockAuth,
}
})); |
does exist @types/mock-amplify-auth? |
I’m not entirely sure how to use these. Is there any documentation you can share?
The text was updated successfully, but these errors were encountered: