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

feat: allow the user to change membership role #515

Merged
merged 10 commits into from
Apr 9, 2024

Conversation

mskwierczynski
Copy link
Contributor

@mskwierczynski mskwierczynski commented Apr 8, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes/features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce?

New feature: membership role update.

What is the current behavior?

What is the new behavior?

Closes #514

@mskwierczynski mskwierczynski marked this pull request as ready for review April 8, 2024 12:47
Copy link
Contributor

Choose a reason for hiding this comment

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

typo in file name:)

Copy link
Contributor

@mkleszcz mkleszcz left a comment

Choose a reason for hiding this comment

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

@mskwierczynski Also please add some feedback to the user as we spoke

import { render } from '../../../tests/utils/rendering';
import { MembershipEntry } from './membershipEntry.component';
import { updateTenantMembershipMutation } from './membershipEntry.graphql';
import { membershipFactory, tenantFactory } from '@sb/webapp-tenants/tests/factories/tenant';
Copy link
Contributor

Choose a reason for hiding this comment

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

use ../../../tests/factories/tenant;


describe('MembershipEntry: Component', () => {
it('should commit update mutation', async () => {
jest.mock('react-router-dom', () => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

You con't need to use this. You can use the tenant id from the tenant passed to currentUserFactory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yes, that's right

}));

render(
<CurrentTenantProvider>
Copy link
Contributor

Choose a reason for hiding this comment

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

Also there should be <CurrentTenantProvider/> already in test providers included so you don't need to wrap the component here.

data,
}));

render(<MembershipEntry membership={membership} />, {
Copy link
Contributor

Choose a reason for hiding this comment

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

We are used to create a const Component = () => <MembershipEntry.../> in every test to we could easily reuse the component props between tests in each test file. Also would be good to add refetch param and check below if it is called after mutation


export type MembershipEntryProps = {
className?: string;
membership: TenantMembershipType;
refetch?: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about changing this name to something more clear? Like onAfterUpdate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. will do

Base automatically changed from feat/multi-tenancy-memberhips to feat/multi-tenancy April 9, 2024 13:20
@mskwierczynski mskwierczynski merged commit 88ef08c into feat/multi-tenancy Apr 9, 2024
56 checks passed
@mskwierczynski mskwierczynski deleted the feat/multi-tenancy-role-change branch April 9, 2024 14:19
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