Skip to content

Commit cf9b3d1

Browse files
test: replace it with test in jest tests (#1980)
1 parent d9067b3 commit cf9b3d1

38 files changed

+244
-244
lines changed

.github/workflows/scripts/__tests__/bundle.test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {generateBundleSizeSection, getBundleInfo} from '../utils/bundle';
22

33
describe('bundle utils', () => {
44
describe('generateBundleSizeSection', () => {
5-
it('should generate section for increased bundle size', () => {
5+
test('should generate section for increased bundle size', () => {
66
const bundleInfo = {
77
currentSize: 1024 * 1024 * 2, // 2MB
88
mainSize: 1024 * 1024, // 1MB
@@ -17,7 +17,7 @@ describe('bundle utils', () => {
1717
expect(result).toContain('⚠️ Bundle size increased. Please review.');
1818
});
1919

20-
it('should generate section for decreased bundle size', () => {
20+
test('should generate section for decreased bundle size', () => {
2121
const bundleInfo = {
2222
currentSize: 1024 * 1024, // 1MB
2323
mainSize: 1024 * 1024 * 2, // 2MB
@@ -32,7 +32,7 @@ describe('bundle utils', () => {
3232
expect(result).toContain('✅ Bundle size decreased.');
3333
});
3434

35-
it('should generate section for unchanged bundle size', () => {
35+
test('should generate section for unchanged bundle size', () => {
3636
const bundleInfo = {
3737
currentSize: 1024 * 1024, // 1MB
3838
mainSize: 1024 * 1024, // 1MB
@@ -47,7 +47,7 @@ describe('bundle utils', () => {
4747
expect(result).toContain('✅ Bundle size unchanged.');
4848
});
4949

50-
it('should handle N/A percent', () => {
50+
test('should handle N/A percent', () => {
5151
const bundleInfo = {
5252
currentSize: 1024 * 1024, // 1MB
5353
mainSize: 0,
@@ -75,7 +75,7 @@ describe('bundle utils', () => {
7575
process.env = originalEnv;
7676
});
7777

78-
it('should get bundle info from environment variables', () => {
78+
test('should get bundle info from environment variables', () => {
7979
process.env.CURRENT_SIZE = '2097152'; // 2MB
8080
process.env.MAIN_SIZE = '1048576'; // 1MB
8181
process.env.SIZE_DIFF = '1048576'; // 1MB
@@ -90,7 +90,7 @@ describe('bundle utils', () => {
9090
});
9191
});
9292

93-
it('should handle missing environment variables', () => {
93+
test('should handle missing environment variables', () => {
9494
process.env.CURRENT_SIZE = undefined;
9595
process.env.MAIN_SIZE = undefined;
9696
process.env.SIZE_DIFF = undefined;

.github/workflows/scripts/__tests__/format.test.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ import {formatSize, generateTestChangesSummary} from '../utils/format';
22

33
describe('format utils', () => {
44
describe('formatSize', () => {
5-
it('should format size in KB when less than 1024 bytes', () => {
5+
test('should format size in KB when less than 1024 bytes', () => {
66
const size = 512; // 512 bytes
77
expect(formatSize(size)).toBe('0.50 KB');
88
});
99

10-
it('should format size in MB when greater than or equal to 1024 bytes', () => {
10+
test('should format size in MB when greater than or equal to 1024 bytes', () => {
1111
const size = 2.5 * 1024; // 2.5 KB -> will be shown in MB
1212
expect(formatSize(size)).toBe('2.50 KB');
1313
});
1414

15-
it('should handle small sizes', () => {
15+
test('should handle small sizes', () => {
1616
const size = 100; // 100 bytes
1717
expect(formatSize(size)).toBe('0.10 KB');
1818
});
1919

20-
it('should handle zero', () => {
20+
test('should handle zero', () => {
2121
expect(formatSize(0)).toBe('0.00 KB');
2222
});
2323
});
2424

2525
describe('generateTestChangesSummary', () => {
26-
it('should generate summary for new tests only', () => {
26+
test('should generate summary for new tests only', () => {
2727
const comparison = {
2828
new: ['Test 1 (file1.ts)', 'Test 2 (file2.ts)'],
2929
skipped: [],
@@ -38,7 +38,7 @@ describe('format utils', () => {
3838
expect(summary).not.toContain('🗑️ Deleted Tests');
3939
});
4040

41-
it('should generate summary for skipped tests only', () => {
41+
test('should generate summary for skipped tests only', () => {
4242
const comparison = {
4343
new: [],
4444
skipped: ['Test 1 (file1.ts)', 'Test 2 (file2.ts)'],
@@ -53,7 +53,7 @@ describe('format utils', () => {
5353
expect(summary).not.toContain('🗑️ Deleted Tests');
5454
});
5555

56-
it('should generate summary for deleted tests only', () => {
56+
test('should generate summary for deleted tests only', () => {
5757
const comparison = {
5858
new: [],
5959
skipped: [],
@@ -68,7 +68,7 @@ describe('format utils', () => {
6868
expect(summary).not.toContain('⏭️ Skipped Tests');
6969
});
7070

71-
it('should generate summary for all types of changes', () => {
71+
test('should generate summary for all types of changes', () => {
7272
const comparison = {
7373
new: ['New Test (file1.ts)'],
7474
skipped: ['Skipped Test (file2.ts)'],
@@ -84,7 +84,7 @@ describe('format utils', () => {
8484
expect(summary).toContain('Deleted Test (file3.ts)');
8585
});
8686

87-
it('should handle no changes', () => {
87+
test('should handle no changes', () => {
8888
const comparison = {
8989
new: [],
9090
skipped: [],

.github/workflows/scripts/__tests__/results.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('results utils', () => {
1111
jest.clearAllMocks();
1212
});
1313

14-
it('should handle non-existent file', () => {
14+
test('should handle non-existent file', () => {
1515
(fs.existsSync as jest.Mock).mockReturnValue(false);
1616

1717
const result = readTestResults('nonexistent.json');
@@ -25,7 +25,7 @@ describe('results utils', () => {
2525
});
2626
});
2727

28-
it('should read and process test results correctly', () => {
28+
test('should read and process test results correctly', () => {
2929
const mockTestResults: TestResults = {
3030
config: {} as any,
3131
suites: [
@@ -87,7 +87,7 @@ describe('results utils', () => {
8787
});
8888

8989
describe('getTestStatus', () => {
90-
it('should return failed status when there are failures', () => {
90+
test('should return failed status when there are failures', () => {
9191
const results: TestResultsInfo = {
9292
total: 10,
9393
passed: 8,
@@ -102,7 +102,7 @@ describe('results utils', () => {
102102
expect(result.statusColor).toBe('red');
103103
});
104104

105-
it('should return flaky status when there are flaky tests but no failures', () => {
105+
test('should return flaky status when there are flaky tests but no failures', () => {
106106
const results: TestResultsInfo = {
107107
total: 10,
108108
passed: 8,
@@ -117,7 +117,7 @@ describe('results utils', () => {
117117
expect(result.statusColor).toBe('orange');
118118
});
119119

120-
it('should return passed status when all tests pass', () => {
120+
test('should return passed status when all tests pass', () => {
121121
const results: TestResultsInfo = {
122122
total: 10,
123123
passed: 10,

.github/workflows/scripts/__tests__/test.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {Spec, Suite, TestInfo} from './types';
33

44
describe('test utils', () => {
55
describe('isTestSkipped', () => {
6-
it('should return true for test with skip annotation', () => {
6+
test('should return true for test with skip annotation', () => {
77
const spec: Spec = {
88
title: 'Test',
99
ok: true,
@@ -27,7 +27,7 @@ describe('test utils', () => {
2727
expect(isTestSkipped(spec)).toBe(true);
2828
});
2929

30-
it('should return true for test with skipped status', () => {
30+
test('should return true for test with skipped status', () => {
3131
const spec: Spec = {
3232
title: 'Test',
3333
ok: true,
@@ -51,7 +51,7 @@ describe('test utils', () => {
5151
expect(isTestSkipped(spec)).toBe(true);
5252
});
5353

54-
it('should return false for non-skipped test', () => {
54+
test('should return false for non-skipped test', () => {
5555
const spec: Spec = {
5656
title: 'Test',
5757
ok: true,
@@ -77,7 +77,7 @@ describe('test utils', () => {
7777
});
7878

7979
describe('extractTestsFromSuite', () => {
80-
it('should extract tests from a simple suite', () => {
80+
test('should extract tests from a simple suite', () => {
8181
const suite: Suite = {
8282
title: 'Suite 1',
8383
file: 'test.spec.ts',
@@ -120,7 +120,7 @@ describe('test utils', () => {
120120
]);
121121
});
122122

123-
it('should handle nested suites', () => {
123+
test('should handle nested suites', () => {
124124
const suite: Suite = {
125125
title: 'Parent Suite',
126126
file: 'test.spec.ts',
@@ -174,7 +174,7 @@ describe('test utils', () => {
174174
});
175175

176176
describe('compareTests', () => {
177-
it('should identify new, skipped, and deleted tests', () => {
177+
test('should identify new, skipped, and deleted tests', () => {
178178
const currentTests: TestInfo[] = [
179179
{
180180
title: 'Test 1',
@@ -210,7 +210,7 @@ describe('test utils', () => {
210210
});
211211
});
212212

213-
it('should handle empty test arrays', () => {
213+
test('should handle empty test arrays', () => {
214214
const result = compareTests([], []);
215215
expect(result).toEqual({
216216
new: [],

.github/workflows/scripts/__tests__/update-pr-description.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ describe('updatePRDescription', () => {
113113
mockGithub.rest.pulls.update.mockResolvedValue({});
114114
});
115115

116-
it('should read both current and main test results', async () => {
116+
test('should read both current and main test results', async () => {
117117
await updatePRDescription(mockGithub, mockContext);
118118

119119
expect(readTestResults).toHaveBeenCalledTimes(2);
120120
expect(readTestResults).toHaveBeenCalledWith('playwright-artifacts/test-results.json');
121121
expect(readTestResults).toHaveBeenCalledWith('gh-pages/main/test-results.json');
122122
});
123123

124-
it('should format CI section with correct table and details', async () => {
124+
test('should format CI section with correct table and details', async () => {
125125
const mockResults: TestResultsInfo = {
126126
total: 5,
127127
passed: 3,
@@ -154,7 +154,7 @@ describe('updatePRDescription', () => {
154154
expect(body).toContain('</details>');
155155
});
156156

157-
it('should handle PR without existing description', async () => {
157+
test('should handle PR without existing description', async () => {
158158
mockGithub.rest.pulls.get.mockResolvedValue({
159159
data: {
160160
body: null,
@@ -168,7 +168,7 @@ describe('updatePRDescription', () => {
168168
expect(updateCall.body).toContain('## CI Results');
169169
});
170170

171-
it('should handle errors in test results', async () => {
171+
test('should handle errors in test results', async () => {
172172
const emptyResults: TestResultsInfo = {
173173
total: 0,
174174
passed: 0,
@@ -192,7 +192,7 @@ describe('updatePRDescription', () => {
192192
expect(updateCall.body).toContain('| 0 | 0 | 0 | 0 | 0 |');
193193
});
194194

195-
it('should include report URL in description', async () => {
195+
test('should include report URL in description', async () => {
196196
await updatePRDescription(mockGithub, mockContext);
197197

198198
expect(mockGithub.rest.pulls.update).toHaveBeenCalled();
@@ -201,7 +201,7 @@ describe('updatePRDescription', () => {
201201
expect(updateCall.body).toContain(expectedUrl);
202202
});
203203

204-
it('should handle failed tests status color', async () => {
204+
test('should handle failed tests status color', async () => {
205205
const failedResults: TestResultsInfo = {
206206
total: 10,
207207
passed: 8,
@@ -224,7 +224,7 @@ describe('updatePRDescription', () => {
224224
expect(updateCall.body).toContain('color: red');
225225
});
226226

227-
it('should handle flaky tests status color', async () => {
227+
test('should handle flaky tests status color', async () => {
228228
const flakyResults: TestResultsInfo = {
229229
total: 10,
230230
passed: 8,

src/components/DateRange/__test__/fromDateRangeValues.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {dateTimeParse} from '@gravity-ui/date-utils';
33
import {fromDateRangeValues} from '../utils';
44

55
describe('From daterange values to datepicker values', () => {
6-
it('should return the correct datepicker values for to-absolute, from-absolute values', () => {
6+
test('should return the correct datepicker values for to-absolute, from-absolute values', () => {
77
const from = new Date('2020-01-01 19:00:00').getTime();
88
const to = new Date('2022-01-01 19:00:00').getTime();
99

@@ -26,7 +26,7 @@ describe('From daterange values to datepicker values', () => {
2626
});
2727
});
2828

29-
it('should return the correct datepicker values for to-relative, from-absolute values', () => {
29+
test('should return the correct datepicker values for to-relative, from-absolute values', () => {
3030
const from = new Date('2020-01-01 19:00:00').getTime();
3131
const to = 'now';
3232

@@ -49,7 +49,7 @@ describe('From daterange values to datepicker values', () => {
4949
});
5050
});
5151

52-
it('should return the correct datepicker values for from-relative, to-absolute values', () => {
52+
test('should return the correct datepicker values for from-relative, to-absolute values', () => {
5353
const from = 'now';
5454
const to = new Date('2022-01-01 19:00:00').getTime();
5555

@@ -72,7 +72,7 @@ describe('From daterange values to datepicker values', () => {
7272
});
7373
});
7474

75-
it('should return the correct datepicker values for from-relative, to-relative values', () => {
75+
test('should return the correct datepicker values for from-relative, to-relative values', () => {
7676
const from = 'now';
7777
const to = 'now + 1h';
7878

src/components/DateRange/__test__/getdatePickerSize.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {dateTimeParse} from '@gravity-ui/date-utils';
44
import {getdatePickerSize} from '../utils';
55

66
describe('getdatePickerSize test', () => {
7-
it('should return the correct datepicker size', () => {
7+
test('should return the correct datepicker size', () => {
88
const datePickerRangeValues = {
99
start: {
1010
type: 'relative',
@@ -18,7 +18,7 @@ describe('getdatePickerSize test', () => {
1818
expect(getdatePickerSize(datePickerRangeValues)).toEqual('s');
1919
});
2020

21-
it('should return the correct datepicker size', () => {
21+
test('should return the correct datepicker size', () => {
2222
const datePickerRangeValues = {
2323
start: {
2424
type: 'absolute',
@@ -32,7 +32,7 @@ describe('getdatePickerSize test', () => {
3232
expect(getdatePickerSize(datePickerRangeValues)).toEqual('m');
3333
});
3434

35-
it('should return the correct datepicker size', () => {
35+
test('should return the correct datepicker size', () => {
3636
const datePickerRangeValues = {
3737
start: {
3838
type: 'relative',
@@ -46,7 +46,7 @@ describe('getdatePickerSize test', () => {
4646
expect(getdatePickerSize(datePickerRangeValues)).toEqual('m');
4747
});
4848

49-
it('should return the correct datepicker size', () => {
49+
test('should return the correct datepicker size', () => {
5050
const datePickerRangeValues = {
5151
start: {
5252
type: 'absolute',

0 commit comments

Comments
 (0)