Skip to content
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
12 changes: 6 additions & 6 deletions .github/workflows/scripts/__tests__/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {generateBundleSizeSection, getBundleInfo} from '../utils/bundle';

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

it('should generate section for decreased bundle size', () => {
test('should generate section for decreased bundle size', () => {
const bundleInfo = {
currentSize: 1024 * 1024, // 1MB
mainSize: 1024 * 1024 * 2, // 2MB
Expand All @@ -32,7 +32,7 @@ describe('bundle utils', () => {
expect(result).toContain('βœ… Bundle size decreased.');
});

it('should generate section for unchanged bundle size', () => {
test('should generate section for unchanged bundle size', () => {
const bundleInfo = {
currentSize: 1024 * 1024, // 1MB
mainSize: 1024 * 1024, // 1MB
Expand All @@ -47,7 +47,7 @@ describe('bundle utils', () => {
expect(result).toContain('βœ… Bundle size unchanged.');
});

it('should handle N/A percent', () => {
test('should handle N/A percent', () => {
const bundleInfo = {
currentSize: 1024 * 1024, // 1MB
mainSize: 0,
Expand Down Expand Up @@ -75,7 +75,7 @@ describe('bundle utils', () => {
process.env = originalEnv;
});

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

it('should handle missing environment variables', () => {
test('should handle missing environment variables', () => {
process.env.CURRENT_SIZE = undefined;
process.env.MAIN_SIZE = undefined;
process.env.SIZE_DIFF = undefined;
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/scripts/__tests__/format.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ import {formatSize, generateTestChangesSummary} from '../utils/format';

describe('format utils', () => {
describe('formatSize', () => {
it('should format size in KB when less than 1024 bytes', () => {
test('should format size in KB when less than 1024 bytes', () => {
const size = 512; // 512 bytes
expect(formatSize(size)).toBe('0.50 KB');
});

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

it('should handle small sizes', () => {
test('should handle small sizes', () => {
const size = 100; // 100 bytes
expect(formatSize(size)).toBe('0.10 KB');
});

it('should handle zero', () => {
test('should handle zero', () => {
expect(formatSize(0)).toBe('0.00 KB');
});
});

describe('generateTestChangesSummary', () => {
it('should generate summary for new tests only', () => {
test('should generate summary for new tests only', () => {
const comparison = {
new: ['Test 1 (file1.ts)', 'Test 2 (file2.ts)'],
skipped: [],
Expand All @@ -38,7 +38,7 @@ describe('format utils', () => {
expect(summary).not.toContain('πŸ—‘οΈ Deleted Tests');
});

it('should generate summary for skipped tests only', () => {
test('should generate summary for skipped tests only', () => {
const comparison = {
new: [],
skipped: ['Test 1 (file1.ts)', 'Test 2 (file2.ts)'],
Expand All @@ -53,7 +53,7 @@ describe('format utils', () => {
expect(summary).not.toContain('πŸ—‘οΈ Deleted Tests');
});

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

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

it('should handle no changes', () => {
test('should handle no changes', () => {
const comparison = {
new: [],
skipped: [],
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/scripts/__tests__/results.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('results utils', () => {
jest.clearAllMocks();
});

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

const result = readTestResults('nonexistent.json');
Expand All @@ -25,7 +25,7 @@ describe('results utils', () => {
});
});

it('should read and process test results correctly', () => {
test('should read and process test results correctly', () => {
const mockTestResults: TestResults = {
config: {} as any,
suites: [
Expand Down Expand Up @@ -87,7 +87,7 @@ describe('results utils', () => {
});

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

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

it('should return passed status when all tests pass', () => {
test('should return passed status when all tests pass', () => {
const results: TestResultsInfo = {
total: 10,
passed: 10,
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/scripts/__tests__/test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {Spec, Suite, TestInfo} from './types';

describe('test utils', () => {
describe('isTestSkipped', () => {
it('should return true for test with skip annotation', () => {
test('should return true for test with skip annotation', () => {
const spec: Spec = {
title: 'Test',
ok: true,
Expand All @@ -27,7 +27,7 @@ describe('test utils', () => {
expect(isTestSkipped(spec)).toBe(true);
});

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

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

describe('extractTestsFromSuite', () => {
it('should extract tests from a simple suite', () => {
test('should extract tests from a simple suite', () => {
const suite: Suite = {
title: 'Suite 1',
file: 'test.spec.ts',
Expand Down Expand Up @@ -120,7 +120,7 @@ describe('test utils', () => {
]);
});

it('should handle nested suites', () => {
test('should handle nested suites', () => {
const suite: Suite = {
title: 'Parent Suite',
file: 'test.spec.ts',
Expand Down Expand Up @@ -174,7 +174,7 @@ describe('test utils', () => {
});

describe('compareTests', () => {
it('should identify new, skipped, and deleted tests', () => {
test('should identify new, skipped, and deleted tests', () => {
const currentTests: TestInfo[] = [
{
title: 'Test 1',
Expand Down Expand Up @@ -210,7 +210,7 @@ describe('test utils', () => {
});
});

it('should handle empty test arrays', () => {
test('should handle empty test arrays', () => {
const result = compareTests([], []);
expect(result).toEqual({
new: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ describe('updatePRDescription', () => {
mockGithub.rest.pulls.update.mockResolvedValue({});
});

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

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

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

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

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

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

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

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

it('should handle flaky tests status color', async () => {
test('should handle flaky tests status color', async () => {
const flakyResults: TestResultsInfo = {
total: 10,
passed: 8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {dateTimeParse} from '@gravity-ui/date-utils';
import {fromDateRangeValues} from '../utils';

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

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

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

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

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

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

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

Expand Down
8 changes: 4 additions & 4 deletions src/components/DateRange/__test__/getdatePickerSize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {dateTimeParse} from '@gravity-ui/date-utils';
import {getdatePickerSize} from '../utils';

describe('getdatePickerSize test', () => {
it('should return the correct datepicker size', () => {
test('should return the correct datepicker size', () => {
const datePickerRangeValues = {
start: {
type: 'relative',
Expand All @@ -18,7 +18,7 @@ describe('getdatePickerSize test', () => {
expect(getdatePickerSize(datePickerRangeValues)).toEqual('s');
});

it('should return the correct datepicker size', () => {
test('should return the correct datepicker size', () => {
const datePickerRangeValues = {
start: {
type: 'absolute',
Expand All @@ -32,7 +32,7 @@ describe('getdatePickerSize test', () => {
expect(getdatePickerSize(datePickerRangeValues)).toEqual('m');
});

it('should return the correct datepicker size', () => {
test('should return the correct datepicker size', () => {
const datePickerRangeValues = {
start: {
type: 'relative',
Expand All @@ -46,7 +46,7 @@ describe('getdatePickerSize test', () => {
expect(getdatePickerSize(datePickerRangeValues)).toEqual('m');
});

it('should return the correct datepicker size', () => {
test('should return the correct datepicker size', () => {
const datePickerRangeValues = {
start: {
type: 'absolute',
Expand Down
Loading
Loading