feat: enhance backup status display and tracking
Added a visual indicator for backups saved today in the admin interface. Updated the backup status type to include a boolean for today's backup existence, and modified relevant components to reflect this change. Enhanced tests to verify the new functionality.
This commit is contained in:
1 parent
747e6e25e0
commit
bf661673c9
6 files changed
+71
-7
No files matched your search
+13
-1
@@ -1,5 +1,5 @@
|
||||
import { createHash } from 'node:crypto';
|
||||
import { mkdtempSync, rmSync } from 'node:fs';
|
||||
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { afterEach, describe, expect, it } from 'vitest';
|
||||
@@ -97,6 +97,18 @@ describe('coordinator sign-in', () => {
|
||||
expect(homeHtml).not.toContain('coordinator@example.invalid');
|
||||
});
|
||||
|
||||
it('shows a backup from today as a short status tag', async () => {
|
||||
const { app, db, config } = await buildApp();
|
||||
mkdirSync(path.join(config.dataDir, 'backups'), { recursive: true });
|
||||
writeFileSync(path.join(config.dataDir, 'backups', 'daily-2026-10-14.db'), '');
|
||||
const cookie = await signIn(app, db);
|
||||
const home = await app.request('/admin', { headers: { cookie } });
|
||||
const homeHtml = await home.text();
|
||||
expect(homeHtml).toContain('class="desk-note is-saved"');
|
||||
expect(homeHtml).toContain('Backup saved today');
|
||||
expect(homeHtml).not.toContain('Database backup saved');
|
||||
});
|
||||
|
||||
it('still accepts a valid link after other guesses from the same network', async () => {
|
||||
const { app, db } = await buildApp();
|
||||
await postLogin(app, 'coordinator@example.invalid');
|
||||
|
||||
Reference in new issue
Block a user