Skip to content
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

Use async/await in auth store, added tests #88

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ljones92
Copy link

Addresses issue #58

@ljones92
Copy link
Author

This also addresses #65 #67 and #68 as well by the looks of it but I can revert those changes if necessary

});

it("SET_AUTH", () => {
const stub = sinon.stub(JwtService, "saveToken");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not need sinon here. Jest is capable of mocking JavaScript.

Resources

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, too used to the mocha+sinon combo

@@ -15,7 +15,7 @@ const state = {
isAuthenticated: !!JwtService.getToken()
};

const getters = {
export const getters = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we export this now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll remove these exports

async [LOGIN](context, credentials) {
try {
const {
data: { user = {} }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep Object destructuring at one level? Otherwise, it gets unreadable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to quite like nested destructuring since it allows you to easily assign default values without having to do a separate check at each level and assign new variable names. I accept that it can make it a bit less readable for people not used to it though so I'll simplify it.

}
};

const mutations = {
export const mutations = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need to export this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants