Rewrite reviewed-finding localStorage hooks.
Dashboard count and report toggle still migrate legacy keys and skip the first persist write.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""Reviewed-finding localStorage hooks live under periscope/src."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = ROOT / "periscope" / "src" / "frontend" / "src"
|
||||
|
||||
|
||||
def test_reviewed_hooks_are_src():
|
||||
for rel in ("hooks/use-reviewed-count.ts", "hooks/use-reviewed-findings.ts"):
|
||||
text = (SRC / rel).read_text(encoding="utf-8")
|
||||
assert "Native Periscope overlay" not in text[:400]
|
||||
|
||||
|
||||
def test_reviewed_count_reads_migrated_key():
|
||||
text = (SRC / "hooks/use-reviewed-count.ts").read_text(encoding="utf-8")
|
||||
assert "export function useReviewedCount" in text
|
||||
assert "reviewedFindingsKey" in text
|
||||
assert "legacyReviewedFindingsKey" in text
|
||||
assert "migrateLocalKey" in text
|
||||
|
||||
|
||||
def test_reviewed_findings_return_shape():
|
||||
text = (SRC / "hooks/use-reviewed-findings.ts").read_text(encoding="utf-8")
|
||||
assert "export function useReviewedFindings" in text
|
||||
assert "toggleReviewed" in text
|
||||
assert "isReviewed" in text
|
||||
assert "reviewedCount" in text
|
||||
assert "reviewedIds" in text
|
||||
assert "getFindingKey" in text
|
||||
assert "skipFirstWrite" in text or "hydrated" in text
|
||||
Reference in New Issue
Block a user