Persist job history and show model usage stats
Test, build, and deploy ComfyUI Jobs / test-build (push) Successful in 5m14s
Test, build, and deploy ComfyUI Jobs / deploy (push) Successful in 16s
Test, build, and deploy ComfyUI Jobs / browser-test (push) Successful in 1m58s
Test, build, and deploy ComfyUI Jobs / qa-gate (push) Successful in 5s
Test, build, and deploy ComfyUI Jobs / test-build (push) Successful in 5m14s
Test, build, and deploy ComfyUI Jobs / deploy (push) Successful in 16s
Test, build, and deploy ComfyUI Jobs / browser-test (push) Successful in 1m58s
Test, build, and deploy ComfyUI Jobs / qa-gate (push) Successful in 5s
This commit is contained in:
@@ -3,6 +3,7 @@ const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { app, jobFromHistory, statusFromHistory } = require('./server');
|
||||
const { createJobStore } = require('./job-store');
|
||||
|
||||
test('serves frontend assets before authentication redirects', async (t) => {
|
||||
const server = app.listen(0);
|
||||
@@ -27,3 +28,15 @@ test('maps completed ComfyUI history into a read-only job summary', () => {
|
||||
test('classifies failed history without exposing mutation paths', () => {
|
||||
assert.equal(statusFromHistory({ status: { messages: [['execution_error', {}]] } }), 'failed');
|
||||
});
|
||||
|
||||
test('persists jobs across syncs and deduplicates model usage by prompt id', () => {
|
||||
const directory = fs.mkdtempSync(path.join(__dirname, 'job-store-test-'));
|
||||
const store = createJobStore(path.join(directory, 'jobs.json'));
|
||||
const job = { promptId: 'prompt-1', title: 'First', status: 'completed', outputCount: 1, models: [{ nodeId: '1', type: 'Checkpoint', name: 'model-a.safetensors' }, { nodeId: '2', type: 'Lora', name: 'style.safetensors' }] };
|
||||
store.sync([job]);
|
||||
store.sync([{ ...job, status: 'completed' }]);
|
||||
store.sync([{ promptId: 'prompt-2', title: 'Second', status: 'completed', outputCount: 1, models: [{ nodeId: '1', type: 'Checkpoint', name: 'model-a.safetensors' }] }]);
|
||||
assert.deepEqual(store.stats(), { totalJobs: 2, totalModels: 2, models: [{ name: 'model-a.safetensors', jobCount: 2 }, { name: 'style.safetensors', jobCount: 1 }] });
|
||||
assert.equal(JSON.parse(fs.readFileSync(store.path, 'utf8')).jobs['prompt-1'].promptId, 'prompt-1');
|
||||
fs.rmSync(directory, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user