feat(image): complete reviewed generation delivery
Memind CI / Test, build, and release guards (pull_request) Successful in 2m47s
Memind CI / Test, build, and release guards (pull_request) Successful in 2m47s
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import test from 'node:test';
|
||||
|
||||
import { listRecentlyModifiedPublicHtmlRelativePaths } from './mindspace-run-public-html-scope.mjs';
|
||||
|
||||
test('scopes fallback HTML discovery to files modified by the current run', () => {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'memind-run-html-'));
|
||||
const publicDir = path.join(root, 'public');
|
||||
fs.mkdirSync(publicDir, { recursive: true });
|
||||
const oldPage = path.join(publicDir, 'legacy-survey.html');
|
||||
const recentlyTouchedHistoricalPage = path.join(publicDir, 'startup-refreshed.html');
|
||||
const currentPage = path.join(publicDir, 'iceland-aurora.html');
|
||||
fs.writeFileSync(oldPage, '<html>old</html>');
|
||||
fs.writeFileSync(recentlyTouchedHistoricalPage, '<html>startup refresh</html>');
|
||||
fs.writeFileSync(currentPage, '<html>new</html>');
|
||||
const runStartedAt = Date.now();
|
||||
fs.utimesSync(oldPage, new Date(runStartedAt - 5 * 60_000), new Date(runStartedAt - 5 * 60_000));
|
||||
fs.utimesSync(
|
||||
recentlyTouchedHistoricalPage,
|
||||
new Date(runStartedAt - 30_000),
|
||||
new Date(runStartedAt - 30_000),
|
||||
);
|
||||
fs.utimesSync(currentPage, new Date(runStartedAt + 1_000), new Date(runStartedAt + 1_000));
|
||||
|
||||
assert.deepEqual(
|
||||
listRecentlyModifiedPublicHtmlRelativePaths(root, { sinceMs: runStartedAt }),
|
||||
['public/iceland-aurora.html'],
|
||||
);
|
||||
});
|
||||
|
||||
test('returns an empty allowlist when no run start time is available', () => {
|
||||
assert.deepEqual(listRecentlyModifiedPublicHtmlRelativePaths('/missing', { sinceMs: null }), []);
|
||||
});
|
||||
Reference in New Issue
Block a user