Files
memind/mindspace-cleanup.test.mjs
T
John 2e14873f2d Initial commit: Memind H5 portal with MindSpace, Plaza, and agent jobs.
Track application source and tests; exclude local env, user workspaces, and runtime data via .gitignore.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-15 15:04:43 -07:00

25 lines
965 B
JavaScript

import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import test from 'node:test';
import { createCleanupService } from './mindspace-cleanup.mjs';
test('lists workspace temp files for cleanup', async () => {
const h5Root = await fs.mkdtemp(path.join(os.tmpdir(), 'mindspace-cleanup-'));
const storageRoot = path.join(h5Root, 'data', 'mindspace');
const username = 'john';
const tempFile = path.join(h5Root, 'temp', username, 'draft.html');
await fs.mkdir(path.dirname(tempFile), { recursive: true });
await fs.writeFile(tempFile, '<html></html>');
const pool = {
query: async () => [[], []],
};
const cleanup = createCleanupService(pool, { h5Root, storageRoot });
const items = await cleanup.listCandidates('user-1', username);
assert.equal(items.length, 1);
assert.equal(items[0].kind, 'workspace_temp');
assert.equal(items[0].label, 'draft.html');
});