Skip to content

Commit

Permalink
Merge pull request #601 from actiontech/fix/sqle-issue-2935
Browse files Browse the repository at this point in the history
[chore](useRuleVersionTIps): Add 'v' prefix to options label for version identification
  • Loading branch information
Rain-1214 authored Feb 28, 2025
2 parents 0004e21 + c5f4243 commit b3e6ba3
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
with:
name: coverage-artifacts-2
path: coverage

- name: Get EE Coverage 3
uses: actions/download-artifact@v4
with:
Expand All @@ -112,7 +112,7 @@ jobs:
coverage-file: coverage-merged.json

- name: Delete artifact
uses: geekyeggo/delete-artifact@v2
uses: geekyeggo/delete-artifact@v5
with:
name: |
ce-coverage-artifacts
Expand Down
8 changes: 4 additions & 4 deletions packages/sqle/src/hooks/useRuleVersionTips/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ describe('useRuleVersionTips', () => {

const mysqlOptions = result.current.generateRuleVersionOptions('MySQL');
expect(mysqlOptions).toEqual([
{ label: '1', value: 1 },
{ label: '2', value: 2 },
{ label: '3', value: 3 }
{ label: 'v1', value: 1 },
{ label: 'v2', value: 2 },
{ label: 'v3', value: 3 }
]);

const pgOptions = result.current.generateRuleVersionOptions('PostgreSQL');
expect(pgOptions).toEqual([{ label: '2', value: 2 }]);
expect(pgOptions).toEqual([{ label: 'v2', value: 2 }]);

const unknownOptions = result.current.generateRuleVersionOptions('unknown');
expect(unknownOptions).toBeUndefined();
Expand Down
2 changes: 1 addition & 1 deletion packages/sqle/src/hooks/useRuleVersionTips/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const useRuleVersionTips = () => {
.find((item) => item.db_type === dbType)
?.rule_versions?.map((item) => {
return {
label: item.toString(),
label: `v${item}`,
value: item
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate create global rule template
</span>
<span
class="ant-select-selection-item"
title="2"
title="v2"
>
2
v2
</span>
</div>
<span
Expand Down Expand Up @@ -1688,15 +1688,15 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate create global rule template
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-label="1"
aria-label="v1"
aria-selected="false"
id="ruleVersion_list_0"
role="option"
>
1
</div>
<div
aria-label="2"
aria-label="v2"
aria-selected="true"
id="ruleVersion_list_1"
role="option"
Expand All @@ -1720,12 +1720,12 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate create global rule template
<div
aria-selected="false"
class="ant-select-item ant-select-item-option ant-select-item-option-active"
title="1"
title="v1"
>
<div
class="ant-select-item-option-content"
>
1
v1
</div>
<span
aria-hidden="true"
Expand All @@ -1737,12 +1737,12 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate create global rule template
<div
aria-selected="true"
class="ant-select-item ant-select-item-option ant-select-item-option-selected"
title="2"
title="v2"
>
<div
class="ant-select-item-option-content"
>
2
v2
</div>
<span
aria-hidden="true"
Expand All @@ -1754,12 +1754,12 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate create global rule template
<div
aria-selected="false"
class="ant-select-item ant-select-item-option"
title="3"
title="v3"
>
<div
class="ant-select-item-option-content"
>
3
v3
</div>
<span
aria-hidden="true"
Expand Down Expand Up @@ -2169,9 +2169,9 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate rule list action 1`] = `
</span>
<span
class="ant-select-selection-item"
title="1"
title="v1"
>
1
v1
</span>
</div>
<span
Expand Down Expand Up @@ -3475,15 +3475,15 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate rule list action 1`] = `
style="height: 0px; width: 0px; overflow: hidden;"
>
<div
aria-label="1"
aria-label="v1"
aria-selected="true"
id="ruleVersion_list_0"
role="option"
>
1
</div>
<div
aria-label="2"
aria-label="v2"
aria-selected="false"
id="ruleVersion_list_1"
role="option"
Expand All @@ -3507,12 +3507,12 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate rule list action 1`] = `
<div
aria-selected="true"
class="ant-select-item ant-select-item-option ant-select-item-option-active ant-select-item-option-selected"
title="1"
title="v1"
>
<div
class="ant-select-item-option-content"
>
1
v1
</div>
<span
aria-hidden="true"
Expand All @@ -3524,12 +3524,12 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate rule list action 1`] = `
<div
aria-selected="false"
class="ant-select-item ant-select-item-option"
title="2"
title="v2"
>
<div
class="ant-select-item-option-content"
>
2
v2
</div>
<span
aria-hidden="true"
Expand All @@ -3541,12 +3541,12 @@ exports[`sqle/GlobalRuleTemplate/CreateRuleTemplate rule list action 1`] = `
<div
aria-selected="false"
class="ant-select-item ant-select-item-option"
title="3"
title="v3"
>
<div
class="ant-select-item-option-content"
>
3
v3
</div>
<span
aria-hidden="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('sqle/GlobalRuleTemplate/CreateRuleTemplate', () => {

fireEvent.mouseDown(getBySelector('#ruleVersion'));
await act(async () => jest.advanceTimersByTime(0));
fireEvent.click(getBySelector('div[title="2"]'));
fireEvent.click(getBySelector('div[title="v2"]'));
expect(getAllRuleSpy).toHaveBeenCalledTimes(2);
expect(getAllRuleSpy).toHaveBeenNthCalledWith(2, {
filter_db_type: 'MySQL',
Expand Down Expand Up @@ -257,7 +257,7 @@ describe('sqle/GlobalRuleTemplate/CreateRuleTemplate', () => {
await act(async () => jest.advanceTimersByTime(3000));
fireEvent.mouseDown(getBySelector('#ruleVersion'));
await act(async () => jest.advanceTimersByTime(0));
fireEvent.click(getBySelector('div[title="1"]'));
fireEvent.click(getBySelector('div[title="v1"]'));
await act(async () => jest.advanceTimersByTime(3000));
fireEvent.click(screen.getByText('下一步'));
await act(async () => jest.advanceTimersByTime(300));
Expand Down Expand Up @@ -356,7 +356,7 @@ describe('sqle/GlobalRuleTemplate/CreateRuleTemplate', () => {
await act(async () => jest.advanceTimersByTime(3000));
fireEvent.mouseDown(getBySelector('#ruleVersion'));
await act(async () => jest.advanceTimersByTime(0));
fireEvent.click(getBySelector('div[title="2"]'));
fireEvent.click(getBySelector('div[title="v2"]'));
await act(async () => jest.advanceTimersByTime(3000));
expect(getAllRuleSpy).toHaveBeenCalledTimes(2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,9 +370,9 @@ exports[`sqle/GlobalRuleTemplate/ImportRuleTemplate import global rule template
</span>
<span
class="ant-select-selection-item"
title="2"
title="v2"
>
2
v2
</span>
</div>
<span
Expand Down Expand Up @@ -3428,9 +3428,9 @@ exports[`sqle/GlobalRuleTemplate/ImportRuleTemplate rule list action 1`] = `
</span>
<span
class="ant-select-selection-item"
title="2"
title="v2"
>
2
v2
</span>
</div>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,9 @@ exports[`sqle/GlobalRuleTemplate/UpdateRuleTemplate rule list action 1`] = `
</span>
<span
class="ant-select-selection-item"
title="2"
title="v2"
>
2
v2
</span>
</div>
<span
Expand Down Expand Up @@ -2569,9 +2569,9 @@ exports[`sqle/GlobalRuleTemplate/UpdateRuleTemplate should match snap shot 1`] =
</span>
<span
class="ant-select-selection-item"
title="2"
title="v2"
>
2
v2
</span>
</div>
<span
Expand Down Expand Up @@ -4138,9 +4138,9 @@ exports[`sqle/GlobalRuleTemplate/UpdateRuleTemplate update global rule template
</span>
<span
class="ant-select-selection-item"
title="2"
title="v2"
>
2
v2
</span>
</div>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ exports[`sqle/Rule filter list based on project name 1`] = `
<span
class="custom-select-option-content-label"
>
2
v2
</span>
</span>
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/sqle/src/page/Rule/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe('sqle/Rule', () => {

fireEvent.mouseDown(getBySelector('#filter_rule_version', baseElement));
await act(async () => jest.advanceTimersByTime(0));
fireEvent.click(getBySelector('div[title="2"]'));
fireEvent.click(getBySelector('div[title="v2"]'));
expect(getAllRulesSpy).toHaveBeenCalledTimes(3);
expect(getAllRulesSpy).toHaveBeenNthCalledWith(3, {
filter_db_type: 'MySQL',
Expand Down
Loading

0 comments on commit b3e6ba3

Please sign in to comment.