-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v16] Add notice to web UI that users arent equal to MAU (#47120)
- Loading branch information
Showing
6 changed files
with
143 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
|
||
import React from 'react'; | ||
import { MemoryRouter } from 'react-router'; | ||
import { render, screen } from 'design/utils/testing'; | ||
import { render, screen, userEvent } from 'design/utils/testing'; | ||
|
||
import { ContextProvider } from 'teleport'; | ||
import { createTeleportContext } from 'teleport/mocks/contexts'; | ||
|
@@ -57,6 +57,8 @@ describe('invite collaborators integration', () => { | |
inviteCollaboratorsOpen: false, | ||
onEmailPasswordResetClose: () => undefined, | ||
EmailPasswordReset: null, | ||
showMauInfo: false, | ||
onDismissUsersMauNotice: () => null, | ||
}; | ||
}); | ||
|
||
|
@@ -105,6 +107,68 @@ describe('invite collaborators integration', () => { | |
}); | ||
}); | ||
|
||
test('Users not equal to MAU Notice', async () => { | ||
const user = userEvent.setup(); | ||
const ctx = createTeleportContext(); | ||
|
||
const props: State = { | ||
attempt: { | ||
message: 'success', | ||
isSuccess: true, | ||
isProcessing: false, | ||
isFailed: false, | ||
}, | ||
users: [], | ||
fetchRoles: () => Promise.resolve([]), | ||
operation: { | ||
type: 'reset', | ||
user: { name: '[email protected]', roles: ['foo'] }, | ||
}, | ||
|
||
onStartCreate: () => undefined, | ||
onStartDelete: () => undefined, | ||
onStartEdit: () => undefined, | ||
onStartReset: () => undefined, | ||
onStartInviteCollaborators: () => undefined, | ||
onClose: () => undefined, | ||
onDelete: () => undefined, | ||
onCreate: () => undefined, | ||
onUpdate: () => undefined, | ||
onReset: () => undefined, | ||
onInviteCollaboratorsClose: () => undefined, | ||
InviteCollaborators: null, | ||
inviteCollaboratorsOpen: false, | ||
onEmailPasswordResetClose: () => undefined, | ||
EmailPasswordReset: null, | ||
showMauInfo: true, | ||
onDismissUsersMauNotice: jest.fn(), | ||
}; | ||
|
||
const { rerender } = render( | ||
<MemoryRouter> | ||
<ContextProvider ctx={ctx}> | ||
<Users {...props} /> | ||
</ContextProvider> | ||
</MemoryRouter> | ||
); | ||
|
||
expect(screen.getByTestId('users-not-mau-alert')).toBeInTheDocument(); | ||
await user.click(screen.getByTestId('dismiss-users-not-mau-alert')); | ||
expect(props.onDismissUsersMauNotice).toHaveBeenCalled(); | ||
|
||
const newProps = { ...props, showMauInfo: false }; | ||
|
||
rerender( | ||
<MemoryRouter> | ||
<ContextProvider ctx={ctx}> | ||
<Users {...newProps} /> | ||
</ContextProvider> | ||
</MemoryRouter> | ||
); | ||
|
||
expect(screen.queryByTestId('users-not-mau-alert')).not.toBeInTheDocument(); | ||
}); | ||
|
||
describe('email password reset integration', () => { | ||
const ctx = createTeleportContext(); | ||
|
||
|
@@ -139,6 +203,8 @@ describe('email password reset integration', () => { | |
inviteCollaboratorsOpen: false, | ||
onEmailPasswordResetClose: () => undefined, | ||
EmailPasswordReset: null, | ||
showMauInfo: false, | ||
onDismissUsersMauNotice: () => null, | ||
}; | ||
}); | ||
|
||
|
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