tests: purge editor drafts after a run

Tests that opened the card modal left hyprcrd-editor-draft:* entries
in localStorage. The pre-run purge cleared them before the baseline
backup, but anything the tests wrote during the run stayed behind —
the user's next card open then fired "unsaved draft from 0 min ago,
restore?" for a non-edit they didn't make. Repeat the purge after
restore so the runner closes with a clean slate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
thandClaude Opus 4.6 committed 2026-04-15 21:28:29 +02:00
1 parent 87ce038b19
commit 8020ddc787
3 files changed
+12 -2

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
<?php <?php
define('APP_NAME', 'hyprcrd'); define('APP_NAME', 'hyprcrd');
define('APP_VERSION', '1.9.9'); define('APP_VERSION', '1.9.10');
// Database path — writable directory, outside webroot // Database path — writable directory, outside webroot
// DB_PATH / UPLOAD_DIR can be pre-defined by the Electron router for app isolation // DB_PATH / UPLOAD_DIR can be pre-defined by the Electron router for app isolation
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hyprcrd", "name": "hyprcrd",
"version": "1.9.9", "version": "1.9.10",
"description": "hyprcrd — self-hosted card manager", "description": "hyprcrd — self-hosted card manager",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {
+10
View File
@@ -587,6 +587,16 @@ async function run() {
await sleep(200); await sleep(200);
} catch {} } catch {}
// 6a. Purge any editor-draft entries the tests wrote while poking
// the modal. Leaving them around means the next card open pops
// "unsaved draft from 0 min ago — restore?" to the user, which
// is noise since the tests weren't real edits of their cards.
try {
for (const k of Object.keys(localStorage)) {
if (k.startsWith('hyprcrd-editor-draft')) localStorage.removeItem(k);
}
} catch {}
// 6b. Put the view back the way the user left it (super-view, sort, // 6b. Put the view back the way the user left it (super-view, sort,
// filters, …) so launching the test runner doesn't silently wipe // filters, …) so launching the test runner doesn't silently wipe
// their working context. // their working context.