|
@@ -64,18 +64,9 @@ describe('Sudo Modal', function () {
|
|
|
const {routerProps} = initializeOrg({router: {params: {}}});
|
|
|
setHasPasswordAuth(true);
|
|
|
|
|
|
- render(
|
|
|
- <App {...routerProps}>
|
|
|
- <div>placeholder content</div>
|
|
|
- </App>
|
|
|
- );
|
|
|
-
|
|
|
const successCb = jest.fn();
|
|
|
const errorCb = jest.fn();
|
|
|
|
|
|
- // No Modal
|
|
|
- expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
|
-
|
|
|
// Should return w/ `sudoRequired`
|
|
|
new MockApiClient().request('/organizations/org-slug/', {
|
|
|
method: 'DELETE',
|
|
@@ -83,6 +74,12 @@ describe('Sudo Modal', function () {
|
|
|
error: errorCb,
|
|
|
});
|
|
|
|
|
|
+ render(
|
|
|
+ <App {...routerProps}>
|
|
|
+ <div>placeholder content</div>
|
|
|
+ </App>
|
|
|
+ );
|
|
|
+
|
|
|
// Should have Modal + input
|
|
|
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
|
|
|
@@ -134,18 +131,15 @@ describe('Sudo Modal', function () {
|
|
|
const {routerProps} = initializeOrg({router: {params: {}}});
|
|
|
setHasPasswordAuth(false);
|
|
|
|
|
|
+ // Should return w/ `sudoRequired` and trigger the modal to open
|
|
|
+ new MockApiClient().request('/organizations/org-slug/', {method: 'DELETE'});
|
|
|
+
|
|
|
render(
|
|
|
<App {...routerProps}>
|
|
|
<div>placeholder content</div>
|
|
|
</App>
|
|
|
);
|
|
|
|
|
|
- // No Modal
|
|
|
- expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
|
|
|
-
|
|
|
- // Should return w/ `sudoRequired` and trigger the modal to open
|
|
|
- new MockApiClient().request('/organizations/org-slug/', {method: 'DELETE'});
|
|
|
-
|
|
|
// Should have Modal + input
|
|
|
expect(await screen.findByRole('dialog')).toBeInTheDocument();
|
|
|
expect(screen.queryByLabelText('Password')).not.toBeInTheDocument();
|