-
Notifications
You must be signed in to change notification settings - Fork 0
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: update create workspace page UI and implement unit tests #226
Conversation
Codecov Report
@@ Coverage Diff @@
## workspace #226 +/- ##
=============================================
- Coverage 66.19% 60.39% -5.81%
=============================================
Files 3431 2162 -1269
Lines 65952 42121 -23831
Branches 10616 7728 -2888
=============================================
- Hits 43659 25437 -18222
+ Misses 19645 14993 -4652
+ Partials 2648 1691 -957
Flags with carried forward coverage won't be shown. Click here to find out more. see 1569 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
src/plugins/workspace/public/components/workspace_creator/workspace_creator.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_creator.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_creator.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_creator.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_creator.test.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
Outdated
Show resolved
Hide resolved
src/plugins/workspace/public/components/workspace_creator/workspace_form.tsx
Outdated
Show resolved
Hide resolved
import React from 'react'; | ||
import { WorkspaceCreator } from './workspace_creator'; | ||
import { PublicAppInfo } from 'opensearch-dashboards/public'; | ||
import { fireEvent, render, waitFor } from '@testing-library/react'; | ||
import * as opensearchReactExports from '../../../../opensearch_dashboards_react/public'; | ||
import { BehaviorSubject } from 'rxjs'; | ||
import { WorkspaceFormSubmitData } from './workspace_form'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better that we import absolute module in the beginning and then relative module. I do not know why OSD lint do not automatically format that but we'd better follow the standard pattern.
jest.mock('../../../../opensearch_dashboards_react/public', () => ({ | ||
...jest.requireActual('../../../../opensearch_dashboards_react/public'), | ||
__esModule: true, | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we return the actual implementation of the target module, why do we doMock on the path?
services: { | ||
application: { | ||
navigateToApp, | ||
getUrlForApp: jest.fn(), | ||
applications$: new BehaviorSubject<Map<string, PublicAppInfo>>(PublicAPPInfoMap as any), | ||
}, | ||
http: { | ||
basePath: { | ||
remove: jest.fn(), | ||
prepend: jest.fn(), | ||
}, | ||
}, | ||
notifications: { | ||
toasts: { | ||
addDanger: notificationToastsAddDanger, | ||
addSuccess: notificationToastsAddSuccess, | ||
}, | ||
}, | ||
workspaceClient: { | ||
create: workspaceClientCreate, | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use
...coreServiceMock.create()
...{
application: {...},
notifications: {...},
workspaceClient: {...}
}
In this case, if coreStart adds any new fields, we do not need to modify the mock here.
grow={false} | ||
> | ||
<EuiIcon size="l" type={item} color={value === item ? color : undefined} /> | ||
const icons = ['Glasses', 'Search', 'Bell', 'Package']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend moving this statement out of the function body if it is a static property.
...plugins/workspace/public/components/workspace_creator/workspace_permission_setting_panel.tsx
Outdated
Show resolved
Hide resolved
/> | ||
aria-label="Delete permission setting" | ||
> | ||
Remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n wrapper maybe?
...plugins/workspace/public/components/workspace_creator/workspace_permission_setting_panel.tsx
Outdated
Show resolved
Hide resolved
color={'text'} | ||
data-test-subj="workspaceForm-permissionSettingPanel-addNew" | ||
> | ||
Add New |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n wrapper maybe.
src/plugins/workspace/public/components/workspace_updater/workspace_updater.tsx
Outdated
Show resolved
Hide resolved
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
…space_updater.tsx Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
…space_permission_setting_panel.tsx Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
…space_permission_setting_panel.tsx Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Signed-off-by: yuye-aws <yuyezhu@amazon.com>
Description
Issues Resolved
Screenshot
Testing the changes
Check List
yarn test:jest
yarn test:jest_integration
yarn test:ftr