Skip to content

Commit bb150e3

Browse files
committed
refactor: wip
1 parent c726123 commit bb150e3

File tree

3 files changed

+0
-25
lines changed

3 files changed

+0
-25
lines changed

packages/utils/src/lib/profiler/wal-json-trace.unit.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,19 +493,11 @@ describe('traceEventWalFormat', () => {
493493
},
494494
};
495495

496-
// Start with encoded string
497496
const initialEncoded = format.codec.encode(originalEvent);
498-
499-
// First decode
500497
const firstDecoded = format.codec.decode(initialEncoded);
501-
502-
// Encode again
503498
const secondEncoded = format.codec.encode(firstDecoded);
504-
505-
// Decode again
506499
const secondDecoded = format.codec.decode(secondEncoded);
507500

508-
// Verify the final decoded event matches the first decoded event
509501
expect(secondDecoded).toStrictEqual(firstDecoded);
510502
expect(secondDecoded).toStrictEqual(originalEvent);
511503
});

packages/utils/src/lib/wal-sharded.int.test.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ describe('ShardedWal Integration', () => {
5858

5959
shardedWal.finalize();
6060

61-
// With filename provided, final file uses the first filename (test-shard-1)
6261
const finalFile = path.join(
6362
testDir,
6463
shardedWal.groupId,
@@ -85,7 +84,6 @@ describe('ShardedWal Integration', () => {
8584
filename: 'shard-1',
8685
});
8786

88-
// Create multiple shards
8987
for (let i = 1; i <= 5; i++) {
9088
const shard = shardedWal.shard();
9189
shard.open();
@@ -95,7 +93,6 @@ describe('ShardedWal Integration', () => {
9593

9694
shardedWal.finalize();
9795

98-
// With filename provided, final file uses the first filename (shard-1)
9996
const finalFile = path.join(
10097
testDir,
10198
shardedWal.groupId,
@@ -140,7 +137,6 @@ describe('ShardedWal Integration', () => {
140137

141138
shardedWal.finalize();
142139

143-
// With filename provided, final file uses the filename (test-shard)
144140
const finalFile = path.join(
145141
testDir,
146142
shardedWal.groupId,
@@ -180,23 +176,18 @@ describe('ShardedWal Integration', () => {
180176

181177
shardedWal.finalize();
182178

183-
// Verify final file exists
184-
// With filename provided, final file uses the first filename (shard-1)
185179
const finalFile = path.join(
186180
testDir,
187181
shardedWal.groupId,
188182
`cleanup-test.shard-1.json`,
189183
);
190184
expect(fs.existsSync(finalFile)).toBeTrue();
191185

192-
// Cleanup should remove shard files (only if coordinator)
193186
shardedWal.cleanupIfCoordinator();
194187

195-
// Verify shard files are removed
196188
const groupDir = path.join(testDir, shardedWal.groupId);
197189
const files = fs.readdirSync(groupDir);
198190
expect(files).not.toContain(expect.stringMatching(/cleanup-test.*\.log$/));
199-
// Final file should still exist (uses first filename: shard-1)
200191
expect(files).toContain(`cleanup-test.shard-1.json`);
201192
});
202193

@@ -222,7 +213,6 @@ describe('ShardedWal Integration', () => {
222213

223214
shardedWal.finalize({ version: '2.0', timestamp: Date.now() });
224215

225-
// With filename provided, final file uses the filename (custom-shard)
226216
const finalFile = path.join(
227217
testDir,
228218
shardedWal.groupId,
@@ -250,7 +240,6 @@ describe('ShardedWal Integration', () => {
250240
groupId: 'empty-shards',
251241
});
252242

253-
// Create group directory but no shards
254243
const groupDir = path.join(testDir, shardedWal.groupId);
255244
fs.mkdirSync(groupDir, { recursive: true });
256245

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,8 @@ describe('ShardedWal', () => {
318318
format: { baseName: 'test', walExtension: '.log' },
319319
});
320320

321-
// Note: This test verifies state transition logic.
322-
// Actual cleanup requires coordinator status which is hard to set up in unit tests.
323-
// The state transition is tested via cleanupIfCoordinator() behavior.
324-
// If instance is coordinator, cleanupIfCoordinator() will clean and set state to 'cleaned'.
325-
// If not coordinator, state remains 'active'.
326321
sw.cleanupIfCoordinator();
327322

328-
// State depends on coordinator status - we test the logic, not the coordinator setup
329323
const state = sw.getState();
330324
expect(['active', 'cleaned']).toContain(state);
331325
});

0 commit comments

Comments
 (0)