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

User store tests #245

Merged
merged 26 commits into from
Sep 28, 2020
Merged

User store tests #245

merged 26 commits into from
Sep 28, 2020

Conversation

zhen0
Copy link
Member

@zhen0 zhen0 commented Sep 22, 2020

PR Checklist:

  • add a short description of what's changed to the top of the CHANGELOG.md
  • add/update tests (or don't, for reasons explained below)

Describe this PR

  • Adds unit tests for the user vuex store
  • Fixes a small bug between tenant setting and the user vuex store
  • Fixes agent vuex store unit tests
  • Adds a circle job to run unit tests on all PRs (Seems to count these as two different checks but I can't see why?)

@zhen0 zhen0 marked this pull request as ready for review September 22, 2020 21:21
znicholasbrown
znicholasbrown previously approved these changes Sep 24, 2020
Copy link
Contributor

@znicholasbrown znicholasbrown left a comment

Choose a reason for hiding this comment

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

A couple small comments and looks like there's a changelog conflict but otherwise LGTM @zhen0

Comment on lines -99 to +104
).tenant
)?.tenant

const firstTenant =
getters['memberships']?.[0] || rootGetters['tenant/tenants']

if (!defaultMembershipId || rootGetters['api/isServer']) return firstTenant
getters['memberships']?.[0]?.tenant || rootGetters['tenant/tenants']?.[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Really good catches on this, hopefully this'll fix some of those edge cases with missing tenants on load.

Comment on lines +76 to +77
first_name: '',
last_name: '',
Copy link
Contributor

Choose a reason for hiding this comment

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

These were missing for long enough that I think we should add a templating function for this user state. We can do that in a follow-up PR though.

Comment on lines +62 to +65
store.commit('setAgents', [{ id: '12345' }])
expect(store.getters.agents).toEqual([
{ id: '12345', secondsSinceLastQuery: 0 }
])
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this introduce a potential race-conditional test failure? There should never be a full second between lines 61 and 63 but...

@zhen0
Copy link
Member Author

zhen0 commented Sep 25, 2020

Merge conflict fixed @znicholasbrown - can you approve again?

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