Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

Mock decks.js in the tombstoneGc unit test

Adam Eivyc43a1313bb34
diff --git a/server/services/sharing/tombstoneGc.test.js b/server/services/sharing/tombstoneGc.test.js
index 6a9fd215cd..84e810c396 100644
--- a/server/services/sharing/tombstoneGc.test.js
+++ b/server/services/sharing/tombstoneGc.test.js
@@ -75,12 +75,12 @@ vi.mock('../creativeCommissions/store.js', () => ({
pruneTombstonedCommissions: vi.fn().mockResolvedValue({ pruned: 0 }),
listCommissionIdsForSync: vi.fn().mockResolvedValue([]),
}));
+vi.mock('../decks.js', () => ({
+ pruneTombstonedDecks: vi.fn().mockResolvedValue({ pruned: 0 }),
+ listDeckIdsForSync: vi.fn().mockResolvedValue([]),
+}));
vi.mock('../../lib/conflictJournal.js', () => ({
pruneOrphanedBaseHashes: vi.fn().mockResolvedValue({ pruned: 0 }),
- // `pruneTombstonedDecks` (services/decks.js) batches its base-hash evictions,
- // so the deck arm of the sweep reaches these two as well.
- withBaseHashFlushBatch: vi.fn(async (fn) => fn()),
- deleteSyncBaseHash: vi.fn().mockResolvedValue(undefined),
}));
vi.mock('./peerSync.js', () => ({
listPeerSubscriptions: vi.fn(),
@@ -122,6 +122,7 @@ import {
import { pruneTombstonedWorks, pruneTombstonedFolders, pruneTombstonedExercises } from '../writersRoom/sync.js';
import { pruneTombstonedCommissionFeedback } from '../creativeCommissions/feedbackStore.js';
import { pruneTombstonedCommissions } from '../creativeCommissions/store.js';
+import { pruneTombstonedDecks } from '../decks.js';
import { pruneOrphanedBaseHashes } from '../../lib/conflictJournal.js';
import { listPeerSubscriptions, pruneOrphanedPeerSubscriptions } from './peerSync.js';
import { getMinAckAcrossPeers } from './peerTombstoneCursors.js';
@@ -168,7 +169,7 @@ describe('TOMBSTONE_GRACE_MS', () => {
});
describe('sweepTombstones — no peers subscribed', () => {
- it('uses now-GRACE as the cutoff for all 16 subscribable kinds when nobody is subscribed (#6843: every cutoff variable, including the 6 renamed to match their kind id, reaches its prune call)', async () => {
+ it('uses now-GRACE as the cutoff for all 17 subscribable kinds when nobody is subscribed (#6843: every cutoff variable, including the 6 renamed to match their kind id, reaches its prune call)', async () => {
await sweepTombstones({ now: NOW });
const expectedCutoff = NOW - TOMBSTONE_GRACE_MS + 1;
expect(pruneTombstonedUniverses).toHaveBeenCalledWith(expectedCutoff);
@@ -196,6 +197,7 @@ describe('sweepTombstones — no peers subscribed', () => {
expect(pruneTombstonedExercises).toHaveBeenCalledWith(expectedCutoff);
expect(pruneTombstonedCommissionFeedback).toHaveBeenCalledWith(expectedCutoff);
expect(pruneTombstonedCommissions).toHaveBeenCalledWith(expectedCutoff);
+ expect(pruneTombstonedDecks).toHaveBeenCalledWith(expectedCutoff);
});
it('refusedFromCutoffs iterates PEER_SUBSCRIBABLE_KINDS (#6843) — refused stays scoped to the 4 kinds whose cutoff can actually be null', async () => {