Skip to content

Commit a99fc0d

Browse files
authored
chore: update unit test coverage to 100% on util files (#2139)
* chore: adds extra test coverage on the analytics utils Signed-off-by: Marcos Iglesias <[email protected]> * chore: adds total test coverage on the analytics utils Signed-off-by: Marcos Iglesias <[email protected]> * chore: total test coverage on date utils Signed-off-by: Marcos Iglesias <[email protected]> * chore: total unit test coverage on navigation utils Signed-off-by: Marcos Iglesias <[email protected]> * chore: total test coverage on number utils Signed-off-by: Marcos Iglesias <[email protected]> * chore: total unit test coverage Signed-off-by: Marcos Iglesias <[email protected]> * chore: total coverage on stats utils Signed-off-by: Marcos Iglesias <[email protected]> * chore: total test coverage on text utils Signed-off-by: Marcos Iglesias <[email protected]> * chore: splits util file tests into files Signed-off-by: Marcos Iglesias <[email protected]> * refactor: renames dateUtils into date Signed-off-by: Marcos Iglesias <[email protected]> * chore: simplifies lint-staged configuration Signed-off-by: Marcos Iglesias <[email protected]> * refactor: renames textUtils into text Signed-off-by: Marcos Iglesias <[email protected]> * refactor: renames ownerUtils into owner Signed-off-by: Marcos Iglesias <[email protected]> * refactor: renames numberUtils into number Signed-off-by: Marcos Iglesias <[email protected]> * refactor: renames navigationUtils into navigation Signed-off-by: Marcos Iglesias <[email protected]> * chore: some tweaks and betterer run Signed-off-by: Marcos Iglesias <[email protected]> * chore: tweaks type checking configuration Signed-off-by: Marcos Iglesias <[email protected]> * chore: updated test Signed-off-by: Marcos Iglesias <[email protected]> --------- Signed-off-by: Marcos Iglesias <[email protected]>
1 parent 5f75de6 commit a99fc0d

File tree

53 files changed

+1235
-943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1235
-943
lines changed

frontend/amundsen_application/static/.betterer.results

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,12 @@ exports[`eslint`] = {
99
[71, 6, 118, "Visible, non-interactive elements with click handlers must have at least one keyboard listener.", "3051403928"],
1010
[71, 6, 118, "Static HTML elements with event handlers require a role.", "3051403928"]
1111
],
12-
"js/components/EditableText/index.tsx:1409200205": [
13-
[79, 6, 13, "Do not use setState in componentDidUpdate", "57229240"],
14-
[97, 6, 13, "Do not use setState in componentDidUpdate", "57229240"],
15-
[154, 19, 20, "Script URL is a form of eval.", "3373049033"]
16-
],
17-
"js/components/OwnerEditor/index.tsx:4022954541": [
18-
[85, 6, 13, "Do not use setState in componentDidUpdate", "57229240"],
19-
[153, 13, 24, "Must use destructuring state assignment", "1659627107"],
20-
[153, 13, 10, "Use callback in setState when referencing the previous state.", "4014904506"],
21-
[168, 8, 3, "Assignment to property of function parameter \'obj\'.", "193420290"],
22-
[209, 23, 24, "Must use destructuring state assignment", "1659627107"],
23-
[211, 48, 24, "Must use destructuring state assignment", "1659627107"]
12+
"js/components/EditableText/index.tsx:175217081": [
13+
[82, 6, 13, "Do not use setState in componentDidUpdate", "57229240"],
14+
[100, 6, 13, "Do not use setState in componentDidUpdate", "57229240"]
15+
],
16+
"js/components/OwnerEditor/index.tsx:2385247435": [
17+
[85, 6, 13, "Do not use setState in componentDidUpdate", "57229240"]
2418
],
2519
"js/components/Preloader/index.tsx:958787996": [
2620
[22, 4, 26, "Must use destructuring props assignment", "1492876559"],
@@ -65,9 +59,9 @@ exports[`eslint`] = {
6559
[19, 2, 8, "Assignment to function parameter \'resource\'.", "2131237679"],
6660
[20, 2, 248, "Expected a default case.", "1034339850"]
6761
],
68-
"js/ducks/tableMetadata/api/v0.ts:893844129": [
69-
[95, 6, 9, "Assignment to property of function parameter \'tableData\'.", "1466754955"],
70-
[144, 23, 2, "Expected to return a value at the end of arrow function.", "5859494"]
62+
"js/ducks/tableMetadata/api/v0.ts:3333048528": [
63+
[92, 6, 9, "Assignment to property of function parameter \'tableData\'.", "1466754955"],
64+
[141, 23, 2, "Expected to return a value at the end of arrow function.", "5859494"]
7165
],
7266
"js/ducks/tableMetadata/reducer.ts:3935312006": [
7367
[482, 6, 84, "Unexpected lexical declaration in case block.", "114266473"]
@@ -95,7 +89,7 @@ exports[`eslint`] = {
9589
[135, 6, 12, "Assignment to function parameter \'currentIndex\'.", "2078922066"],
9690
[178, 4, 10, "Assignment to function parameter \'columnType\'.", "460876587"]
9791
],
98-
"js/features/Footer/index.tsx:3032041713": [
92+
"js/features/Footer/index.tsx:3658564998": [
9993
[45, 8, 22, "Must use destructuring props assignment", "1925601400"],
10094
[49, 12, 22, "Must use destructuring props assignment", "1925601400"]
10195
],
@@ -120,16 +114,16 @@ exports[`eslint`] = {
120114
"js/pages/DashboardPage/QueryList/index.tsx:2324422660": [
121115
[14, 0, 516, "Component should be written as a pure function", "698708664"]
122116
],
123-
"js/pages/DashboardPage/index.tsx:3424122174": [
124-
[131, 6, 13, "Do not use setState in componentDidUpdate", "57229240"]
117+
"js/pages/DashboardPage/index.tsx:1714082706": [
118+
[127, 6, 13, "Do not use setState in componentDidUpdate", "57229240"]
125119
],
126120
"js/pages/HomePage/index.tsx:2768486505": [
127121
[59, 4, 22, "Must use destructuring props assignment", "2151395318"]
128122
],
129-
"js/pages/ProfilePage/index.tsx:4225862884": [
130-
[108, 23, 16, "Must use destructuring props assignment", "1899951550"],
131-
[110, 19, 17, "Must use destructuring state assignment", "3172298888"],
132-
[111, 6, 13, "Do not use setState in componentDidUpdate", "57229240"]
123+
"js/pages/ProfilePage/index.tsx:2077253528": [
124+
[104, 23, 16, "Must use destructuring props assignment", "1899951550"],
125+
[106, 19, 17, "Must use destructuring state assignment", "3172298888"],
126+
[107, 6, 13, "Do not use setState in componentDidUpdate", "57229240"]
133127
],
134128
"js/pages/SearchPage/ResourceSelector/index.tsx:1426301798": [
135129
[67, 19, 19, "Must use destructuring props assignment", "3960624135"]
@@ -153,11 +147,8 @@ exports[`eslint`] = {
153147
"js/pages/TableDetailPage/TableOwnerEditor/index.tsx:2069554136": [
154148
[30, 4, 3, "Assignment to property of function parameter \'obj\'.", "193420290"]
155149
],
156-
"js/utils/ownerUtils.ts:2186084439": [
150+
"js/utils/owner.ts:2186084439": [
157151
[10, 4, 9, "Assignment to property of function parameter \'resultObj\'.", "1686251499"]
158-
],
159-
"js/utils/textUtils.ts:4144938777": [
160-
[19, 6, 46, "Unexpected lexical declaration in case block.", "156477898"]
161152
]
162153
}`
163154
};

frontend/amundsen_application/static/js/components/Flag/Flag.story.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import React from 'react';
55

66
import { BadgeStyle } from 'config/config-types';
7-
import { CaseType } from 'utils/textUtils';
7+
import { CaseType } from 'utils/text';
88
import StorySection from '../StorySection';
99
import Flag from '.';
1010

frontend/amundsen_application/static/js/components/Flag/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import * as React from 'react';
55

66
import { BadgeStyle } from 'config/config-types';
7-
import { convertText, CaseType } from 'utils/textUtils';
7+
import { convertText, CaseType } from 'utils/text';
88

99
import './styles.scss';
1010

frontend/amundsen_application/static/js/components/ResourceListItem/DashboardListItem/index.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import BookmarkIcon from 'components/Bookmark/BookmarkIcon';
99
import { ResourceType } from 'interfaces';
1010

1111
import * as ConfigUtils from 'config/config-utils';
12-
import * as DateUtils from 'utils/dateUtils';
12+
import * as DateUtils from 'utils/date';
1313

1414
import { dashboardSummary } from 'fixtures/metadata/dashboard';
1515
import { NO_TIMESTAMP_TEXT } from '../../../constants';
@@ -25,7 +25,7 @@ jest.mock('config/config-utils', () => ({
2525
getSourceDisplayName: jest.fn(() => MOCK_DISPLAY_NAME),
2626
getSourceIconClass: jest.fn(() => MOCK_ICON_CLASS),
2727
}));
28-
jest.mock('utils/dateUtils', () => ({
28+
jest.mock('utils/date', () => ({
2929
formatDate: jest.fn(() => MOCK_DATE),
3030
}));
3131

frontend/amundsen_application/static/js/components/ResourceListItem/DashboardListItem/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import BookmarkIcon from 'components/Bookmark/BookmarkIcon';
88

99
import { getSourceDisplayName, getSourceIconClass } from 'config/config-utils';
1010
import { logClick } from 'utils/analytics';
11-
import { buildDashboardURL } from 'utils/navigationUtils';
12-
import { formatDate } from 'utils/dateUtils';
11+
import { buildDashboardURL } from 'utils/navigation';
12+
import { formatDate } from 'utils/date';
1313

1414
import { ResourceType, DashboardResource } from 'interfaces';
1515

frontend/amundsen_application/static/js/config/config-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import AppConfig from 'config/config';
22
import { BadgeStyle, BadgeStyleConfig } from 'config/config-types';
3-
import { convertText, CaseType } from 'utils/textUtils';
3+
import { convertText, CaseType } from 'utils/text';
44

55
import { TableMetadata } from 'interfaces/TableMetadata';
66
import { ResourceType } from '../interfaces';

frontend/amundsen_application/static/js/ducks/feature/sagas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { SagaIterator } from 'redux-saga';
33
import { all, call, put, select, takeEvery } from 'redux-saga/effects';
44

55
import { ResourceType } from 'interfaces/Resources';
6-
import { createOwnerUpdatePayload } from 'utils/ownerUtils';
6+
import { createOwnerUpdatePayload } from 'utils/owner';
77
import { getFeatureLineage } from 'ducks/lineage/api/v0';
88
import { GetFeatureLineage } from 'ducks/lineage/types';
99
import * as API from './api/v0';

frontend/amundsen_application/static/js/ducks/search/reducer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
UserResource,
88
} from 'interfaces';
99

10-
import * as NavigationUtils from 'utils/navigationUtils';
10+
import * as NavigationUtils from 'utils/navigation';
1111

1212
import globalState from 'fixtures/globalState';
1313

frontend/amundsen_application/static/js/ducks/search/sagas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as qs from 'simple-query-string';
1212

1313
import { ResourceType, SearchType } from 'interfaces';
1414

15-
import { BrowserHistory, updateSearchUrl } from 'utils/navigationUtils';
15+
import { BrowserHistory, updateSearchUrl } from 'utils/navigation';
1616
import { getSearchResultsPerPage } from 'config/config-utils';
1717
import * as API from './api/v0';
1818

frontend/amundsen_application/static/js/ducks/search/tests/sagas.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
TableResource,
88
} from 'interfaces';
99

10-
import * as NavigationUtils from 'utils/navigationUtils';
10+
import * as NavigationUtils from 'utils/navigation';
1111
import * as SearchUtils from 'ducks/search/utils';
1212

1313
import globalState from 'fixtures/globalState';

0 commit comments

Comments
 (0)