Skip to content

Commit 82d8c20

Browse files
committed
refactor: remove duplicated tests
1 parent 058c9c1 commit 82d8c20

File tree

1 file changed

+0
-78
lines changed

1 file changed

+0
-78
lines changed

packages/utils/src/lib/wal.unit.test.ts

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
import { vol } from 'memfs';
22
import { MEMFS_VOLUME } from '@code-pushup/test-utils';
3-
import {
4-
ID_PATTERNS,
5-
getUniqueInstanceId,
6-
getUniqueTimeId,
7-
} from './process-id.js';
83
import { SHARDED_WAL_COORDINATOR_ID_ENV_VAR } from './profiler/constants.js';
94
import {
105
type Codec,
@@ -506,79 +501,6 @@ describe('stringCodec', () => {
506501
});
507502
});
508503

509-
describe('getUniqueInstanceId', () => {
510-
it('should generate shard ID with readable timestamp', () => {
511-
const counter = { next: () => 1 };
512-
const result = getUniqueInstanceId(counter);
513-
514-
expect(result).toMatch(ID_PATTERNS.INSTANCE_ID);
515-
expect(result).toStartWith('20231114-221320-000.');
516-
});
517-
518-
it('should generate different shard IDs for different calls', () => {
519-
let count = 0;
520-
const counter = { next: () => ++count };
521-
const result1 = getUniqueInstanceId(counter);
522-
const result2 = getUniqueInstanceId(counter);
523-
524-
expect(result1).not.toBe(result2);
525-
expect(result1).toStartWith('20231114-221320-000.');
526-
expect(result2).toStartWith('20231114-221320-000.');
527-
});
528-
529-
it('should handle zero values', () => {
530-
const counter = { next: () => 1 };
531-
const result = getUniqueInstanceId(counter);
532-
expect(result).toStartWith('20231114-221320-000.');
533-
});
534-
535-
it('should handle negative timestamps', () => {
536-
const counter = { next: () => 1 };
537-
const result = getUniqueInstanceId(counter);
538-
539-
expect(result).toStartWith('20231114-221320-000.');
540-
});
541-
542-
it('should handle large timestamps', () => {
543-
const counter = { next: () => 1 };
544-
const result = getUniqueInstanceId(counter);
545-
546-
expect(result).toStartWith('20231114-221320-000.');
547-
});
548-
549-
it('should generate incrementing counter', () => {
550-
let count = 0;
551-
const counter = { next: () => ++count };
552-
const result1 = getUniqueInstanceId(counter);
553-
const result2 = getUniqueInstanceId(counter);
554-
555-
const parts1 = result1.split('.');
556-
const parts2 = result2.split('.');
557-
const counter1 = parts1.at(-1) as string;
558-
const counter2 = parts2.at(-1) as string;
559-
560-
expect(Number.parseInt(counter1, 10)).toBe(
561-
Number.parseInt(counter2, 10) - 1,
562-
);
563-
});
564-
});
565-
566-
describe('getUniqueTimeId', () => {
567-
it('should work with mocked timeOrigin', () => {
568-
const result = getUniqueTimeId();
569-
570-
expect(result).toBe('20231114-221320-000');
571-
expect(result).toMatch(ID_PATTERNS.TIME_ID);
572-
});
573-
574-
it('should be idempotent within same process', () => {
575-
const result1 = getUniqueTimeId();
576-
const result2 = getUniqueTimeId();
577-
578-
expect(result1).toBe(result2);
579-
});
580-
});
581-
582504
describe('parseWalFormat', () => {
583505
it('should apply all defaults when given empty config', () => {
584506
const result = parseWalFormat({});

0 commit comments

Comments
 (0)