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

[test](sqle/SqlAudit): add unit tests #174

Merged
merged 7 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/base/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { DMS_REDIRECT_KEY_PARAMS_NAME } from '@actiontech/shared/lib/data/common';
import { useRequest } from 'ahooks';
import dms from '@actiontech/shared/lib/api/base/service/dms';
import useSystemConfig from './hooks/useSystemConfig.tsx';
import useSystemConfig from './hooks/useSystemConfig';
import { RouterConfigItem } from '@actiontech/shared/lib/types/common.type';
import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`test base/hooks/useSystemConfig.tsx render custom web title 1`] = `
exports[`test base/hooks/useSystemConfig render custom web title 1`] = `
<div>
<div
class="title"
Expand All @@ -14,7 +14,7 @@ exports[`test base/hooks/useSystemConfig.tsx render custom web title 1`] = `
</div>
`;

exports[`test base/hooks/useSystemConfig.tsx render default web title and logo 1`] = `
exports[`test base/hooks/useSystemConfig render default web title and logo 1`] = `
<div>
<div
class="title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jest.mock('react-redux', () => ({
useDispatch: jest.fn(),
useSelector: jest.fn()
}));
describe('test base/hooks/useSystemConfig.tsx', () => {
describe('test base/hooks/useSystemConfig', () => {
const scopeDispatch = jest.fn();

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/page/Login/components/LoginLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
LoginPageLeftStyleWrapper,
LoginPageRightStyleWrapper
} from '../style';
import useSystemConfig from '../../../hooks/useSystemConfig.tsx';
import useSystemConfig from '../../../hooks/useSystemConfig';

const LoginLayout: React.FC<{
children?: React.ReactNode;
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/page/Nav/SideMenu/ProjectTitle/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useNavigate } from 'react-router-dom';
import useSystemConfig from '../../../../hooks/useSystemConfig.tsx';
import useSystemConfig from '../../../../hooks/useSystemConfig';

const ProjectTitle: React.FC = () => {
const navigate = useNavigate();
Expand Down
2 changes: 1 addition & 1 deletion packages/base/src/page/System/PersonalizeSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ResponseCode } from '@actiontech/shared/lib/enum';
import { useMemo } from 'react';
import { ConfigFieldMapMeta } from '@actiontech/shared/lib/components/ConfigItem/index.type';
import useHideConfigInputNode from '@actiontech/shared/lib/components/ConfigItem/hooks/useHideConfigInputNode';
import useSystemConfig from '../../../hooks/useSystemConfig.tsx';
import useSystemConfig from '../../../hooks/useSystemConfig';

const PersonalizeSetting: React.FC = () => {
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`sqle/hooks/useSQLAuditRecordTag should get tags data from request 1`] = `
<body>
<div />
<div>
<div
class="ant-select css-dev-only-do-not-override-txh9fw ant-select-single ant-select-show-arrow"
>
<div
class="ant-select-selector"
>
<span
class="ant-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="false"
aria-haspopup="listbox"
aria-owns="rc_select_TEST_OR_SSR_list"
autocomplete="off"
class="ant-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
</span>
<span
class="ant-select-selection-placeholder"
/>
</div>
<span
aria-hidden="true"
class="ant-select-arrow"
style="user-select: none;"
unselectable="on"
>
<span
aria-label="down"
class="anticon anticon-down ant-select-suffix"
role="img"
>
<svg
aria-hidden="true"
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</span>
</span>
</div>
</div>
</body>
`;

exports[`sqle/hooks/useSQLAuditRecordTag should get tags data from request 2`] = `
<body>
<div>
<div
class="ant-select css-dev-only-do-not-override-txh9fw ant-select-single ant-select-show-arrow"
data-testid="testId"
>
<div
class="ant-select-selector"
>
<span
class="ant-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="false"
aria-haspopup="listbox"
aria-owns="rc_select_TEST_OR_SSR_list"
autocomplete="off"
class="ant-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
</span>
<span
class="ant-select-selection-item"
>
<span
class="ant-tag ant-tag-geekblue basic-tag-wrapper basic-default-tag-wrapper css-n94hhh css-dev-only-do-not-override-txh9fw"
>
test
</span>
</span>
</div>
<span
aria-hidden="true"
class="ant-select-arrow"
style="user-select: none;"
unselectable="on"
>
<span
aria-label="down"
class="anticon anticon-down ant-select-suffix"
role="img"
>
<svg
aria-hidden="true"
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</span>
</span>
</div>
</div>
</body>
`;

exports[`sqle/hooks/useSQLAuditRecordTag should get tags data from request 3`] = `
<body>
<div>
<div
class="ant-select css-dev-only-do-not-override-txh9fw ant-select-single ant-select-show-arrow ant-select-open"
data-testid="testId"
>
<div
class="ant-select-selector"
>
<span
class="ant-select-selection-search"
>
<input
aria-activedescendant="rc_select_TEST_OR_SSR_list_0"
aria-autocomplete="list"
aria-controls="rc_select_TEST_OR_SSR_list"
aria-expanded="true"
aria-haspopup="listbox"
aria-owns="rc_select_TEST_OR_SSR_list"
autocomplete="off"
class="ant-select-selection-search-input"
id="rc_select_TEST_OR_SSR"
readonly=""
role="combobox"
style="opacity: 0;"
type="search"
unselectable="on"
value=""
/>
</span>
<span
class="ant-select-selection-item"
>
<span
class="ant-tag ant-tag-geekblue basic-tag-wrapper basic-default-tag-wrapper css-n94hhh css-dev-only-do-not-override-txh9fw"
>
test
</span>
</span>
</div>
<span
aria-hidden="true"
class="ant-select-arrow"
style="user-select: none;"
unselectable="on"
>
<span
aria-label="down"
class="anticon anticon-down ant-select-suffix"
role="img"
>
<svg
aria-hidden="true"
data-icon="down"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"
/>
</svg>
</span>
</span>
</div>
</div>
<div>
<div
class="ant-select-dropdown ant-slide-up-appear ant-slide-up-appear-prepare ant-slide-up css-dev-only-do-not-override-txh9fw ant-select-dropdown-placement-bottomLeft"
style="--arrow-x: 0px; --arrow-y: 0px; left: -1000vw; top: -1000vh; box-sizing: border-box; min-width: 0; width: 0px;"
>
<div>
<div
id="rc_select_TEST_OR_SSR_list"
role="listbox"
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-selected="true"
id="rc_select_TEST_OR_SSR_list_0"
role="option"
>
test
</div>
<div
aria-selected="false"
id="rc_select_TEST_OR_SSR_list_1"
role="option"
>
test1
</div>
</div>
<div
class="rc-virtual-list"
style="position: relative;"
>
<div
class="rc-virtual-list-holder"
style="max-height: 256px; overflow-y: hidden;"
>
<div>
<div
class="rc-virtual-list-holder-inner"
style="display: flex; flex-direction: column;"
>
<div
aria-selected="true"
class="ant-select-item ant-select-item-option ant-select-item-option-active ant-select-item-option-selected"
>
<div
class="ant-select-item-option-content"
>
<span
class="ant-tag ant-tag-geekblue basic-tag-wrapper basic-default-tag-wrapper css-n94hhh css-dev-only-do-not-override-txh9fw"
>
test
</span>
</div>
<span
aria-hidden="true"
class="ant-select-item-option-state"
style="user-select: none;"
unselectable="on"
/>
</div>
<div
aria-selected="false"
class="ant-select-item ant-select-item-option"
>
<div
class="ant-select-item-option-content"
>
<span
class="ant-tag ant-tag-geekblue basic-tag-wrapper basic-default-tag-wrapper css-n94hhh css-dev-only-do-not-override-txh9fw"
>
test1
</span>
</div>
<span
aria-hidden="true"
class="ant-select-item-option-state"
style="user-select: none;"
unselectable="on"
/>
</div>
</div>
</div>
</div>
<div
class="rc-virtual-list-scrollbar"
style="width: 8px; top: 0px; bottom: 0px; right: 0px; position: absolute; display: none;"
>
<div
class="rc-virtual-list-scrollbar-thumb"
style="width: 100%; height: 128px; top: 0px; left: 0px; position: absolute; background: rgba(0, 0, 0, 0.5); border-radius: 99px; cursor: pointer; user-select: none;"
/>
</div>
</div>
</div>
</div>
</div>
</body>
`;
Loading
Loading