fix: lint

This commit is contained in:
Johannes Millan 2026-01-27 22:19:01 +01:00
parent 7f6c20a1c9
commit fb759a0848
5 changed files with 13 additions and 21 deletions

View file

@ -5,7 +5,7 @@ import { VectorClockService } from '../sync/vector-clock.service';
import { OperationLogStoreService } from '../persistence/operation-log-store.service';
import { ClientIdService } from '../../core/util/client-id.service';
import { PreMigrationBackupService } from './pre-migration-backup.service';
import { OpType, Operation } from '../core/operation.types';
import { Operation, OpType } from '../core/operation.types';
import { ActionType } from '../core/action-types.enum';
import { CURRENT_SCHEMA_VERSION } from '../persistence/schema-migration.service';
@ -66,7 +66,7 @@ describe('CleanSlateService', () => {
// Setup default mock responses
mockStateSnapshotService.getStateSnapshotAsync.and.resolveTo(mockState as any);
mockVectorClockService.getCurrentVectorClock.and.resolveTo(mockVectorClock);
mockClientIdService.generateNewClientId.and.resolveTo('E_newC');
mockClientIdService.generateNewClientId.and.resolveTo('eNewC');
mockPreMigrationBackupService.createPreMigrationBackup.and.resolveTo();
mockOpLogStore.clearAllOperations.and.resolveTo();
mockOpLogStore.append.and.resolveTo(1);
@ -100,21 +100,18 @@ describe('CleanSlateService', () => {
expect(appendedOp.opType).toBe(OpType.SyncImport);
expect(appendedOp.entityType).toBe('ALL');
expect(appendedOp.payload).toBe(mockState);
expect(appendedOp.clientId).toBe('E_newC');
// eslint-disable-next-line @typescript-eslint/naming-convention
expect(appendedOp.vectorClock).toEqual({ E_newC: 1 });
expect(appendedOp.clientId).toBe('eNewC');
expect(appendedOp.vectorClock).toEqual({ eNewC: 1 });
expect(appendedOp.schemaVersion).toBe(CURRENT_SCHEMA_VERSION);
// Should update vector clock
// eslint-disable-next-line @typescript-eslint/naming-convention
expect(mockOpLogStore.setVectorClock).toHaveBeenCalledWith({ E_newC: 1 });
expect(mockOpLogStore.setVectorClock).toHaveBeenCalledWith({ eNewC: 1 });
// Should save snapshot
expect(mockOpLogStore.saveStateCache).toHaveBeenCalledWith({
state: mockState,
lastAppliedOpSeq: 0,
// eslint-disable-next-line @typescript-eslint/naming-convention
vectorClock: { E_newC: 1 },
vectorClock: { eNewC: 1 },
compactedAt: jasmine.any(Number),
schemaVersion: CURRENT_SCHEMA_VERSION,
});
@ -153,8 +150,7 @@ describe('CleanSlateService', () => {
await service.createCleanSlate('ENCRYPTION_CHANGE');
const appendedOp = mockOpLogStore.append.calls.mostRecent().args[0] as Operation;
// eslint-disable-next-line @typescript-eslint/naming-convention
expect(appendedOp.vectorClock).toEqual({ E_newC: 1 });
expect(appendedOp.vectorClock).toEqual({ eNewC: 1 });
});
it('should create operation with valid UUIDv7', async () => {
@ -264,8 +260,8 @@ describe('CleanSlateService', () => {
// The protected IDs should include ALL keys from the SYNC_IMPORT's vector clock
// The new clock will be: { ...multiClientClock, E_newC: increment }
const protectedIds =
mockOpLogStore.setProtectedClientIds.calls.mostRecent().args[0] as string[];
const protectedIds = mockOpLogStore.setProtectedClientIds.calls.mostRecent()
.args[0] as string[];
// Should contain the new client ID
expect(protectedIds).toContain('E_newC');

View file

@ -613,8 +613,8 @@ describe('ServerMigrationService', () => {
// The protected IDs should include ALL keys from the SYNC_IMPORT's vector clock:
// merged clock = { test-client: 5, client-A: 1, client-B: 50, client-C: 100 }
// then incremented = { test-client: 6, client-A: 1, client-B: 50, client-C: 100 }
const protectedIds =
opLogStoreSpy.setProtectedClientIds.calls.mostRecent().args[0] as string[];
const protectedIds = opLogStoreSpy.setProtectedClientIds.calls.mostRecent()
.args[0] as string[];
expect(protectedIds).toContain('test-client');
expect(protectedIds).toContain('client-A');
expect(protectedIds).toContain('client-B');

View file

@ -10,7 +10,7 @@ import { SnackService } from '../../core/snack/snack.service';
import { T } from '../../t.const';
import { loadAllData } from '../../root-store/meta/load-all-data.action';
import { CURRENT_SCHEMA_VERSION } from '../persistence/schema-migration.service';
import { Operation, OpType, ActionType } from '../core/operation.types';
import { ActionType, Operation, OpType } from '../core/operation.types';
import { uuidv7 } from '../../util/uuid-v7';
import { OpLog } from '../../core/log';
import { SYSTEM_TAG_IDS } from '../../features/tag/tag.const';

View file

@ -1301,7 +1301,6 @@ describe('SyncImportFilterService', () => {
const syncImportClock = {
// eslint-disable-next-line @typescript-eslint/naming-convention
A_3Xx3: 5,
// eslint-disable-next-line @typescript-eslint/naming-convention
A_AMT3: 81,
// eslint-disable-next-line @typescript-eslint/naming-convention
A_EemJ: 1,
@ -1336,7 +1335,6 @@ describe('SyncImportFilterService', () => {
// All entries from import are preserved
// eslint-disable-next-line @typescript-eslint/naming-convention
A_3Xx3: 5,
// eslint-disable-next-line @typescript-eslint/naming-convention
A_AMT3: 81,
// eslint-disable-next-line @typescript-eslint/naming-convention
A_EemJ: 1,
@ -1368,7 +1366,6 @@ describe('SyncImportFilterService', () => {
const syncImportClock = {
// eslint-disable-next-line @typescript-eslint/naming-convention
A_3Xx3: 5,
// eslint-disable-next-line @typescript-eslint/naming-convention
A_AMT3: 81,
// eslint-disable-next-line @typescript-eslint/naming-convention
A_EemJ: 1,
@ -1403,7 +1400,6 @@ describe('SyncImportFilterService', () => {
vectorClock: {
// Only kept the highest counter entries (pruned to ~8 entries)
// Missing: A_3Xx3, A_EemJ, A_wU5p, A_ypDK, B_bC8O (all with low counters)
// eslint-disable-next-line @typescript-eslint/naming-convention
A_AMT3: 81,
// eslint-disable-next-line @typescript-eslint/naming-convention
A_Jxm0: 36, // Incremented from 35

View file

@ -321,7 +321,7 @@ describe('Performance Integration', () => {
expect(compactDuration).toBeLessThan(10000); // < 10 seconds
console.log(`Compaction: ${compactDuration}ms for ${operationCount} ops`);
});
}, 15000);
});
describe('Concurrent operation handling', () => {