Commit d1c150a
test: port core.test.ts → Idris2 (partial; estate port 6/11, file 1 of 4) (#55)
## Summary
Estate port **6/11** per ESTATE-ROLLOUT.adoc. **PARTIAL** — this PR
ports ONLY \`tests/core.test.ts\` (1 of 4 TS test files in ubicity). The
other 3 (privacy/mapper/export) await separate PRs after the unit-logic
strategy review documented in repos-monorepo PR #12.
| | Before | After |
|---|---|---|
| core.test.ts | 5 tests | **3 ported / 2 deferred** |
| Pass rate | (unrun) | **3/3 PASS** |
| Other TS test files (privacy/mapper/export) | 3 files, 489 LOC |
Untouched — separate PRs after strategy review |
| Run via | \`deno test --allow-read tests/\` | \`just test-core\` |
## What's ported (3 tests)
| TS test | Idris2 approach |
|---|---|
| LearningExperience validation | Defines mirror records
(Location/Learner/Experience/LearningExperience), constructs a literal
value, asserts field presence + domain length. |
| Timestamp ISO 8601 shape | Checks for \`T\` + \`Z\` markers; length
sanity check. |
| Domain array dedup/normalize/filter | Uses Idris2 stdlib \`nub\` +
\`map toLower\` + \`filter isPrefixOf\`. |
## What's deferred (2 tests)
| TS test | Why deferred |
|---|---|
| Core - Data persistence | Needs JSON parse + temp-file write. Idris2
base stdlib lacks JSON. Would need \`idris2-json\` dep or a custom
parser. |
| Core - ID generation uniqueness | Needs \`crypto.randomUUID()\`.
Idris2 base lacks crypto. Would need crypto dep or deterministic-RNG
mock (defeats the uniqueness check). |
## Patterns applied
From
\`panic-free-tests-and-benches/clade-registry/clade-A/idris2/PATTERNS.adoc\`:
- \`ascii-only-string-literals-idris2\`
- \`one-mega-list-for-testcases-idris2\`
**New learning** (worth a registry PR follow-up): Idris2's \`head\`
requires NonEmpty proof. Use cons-cell pattern match for safe
first-element access:
\`\`\`idris2
case xs of
(h :: _) => h
[] => default
\`\`\`
## Why partial
ubicity's other 3 TS files include SHA-256 hashing (privacy.test.ts),
JSON parsing (export.test.ts), and file mapping logic (mapper.test.ts)
that require substantial Idris2 dependencies or a different port
strategy entirely. The ESTATE-ROLLOUT.adoc \"unit-logic strategy\"
section flags this — each repo needs a decision (Idris2 mirror /
canonical-language port / delete) before more porting work.
This PR is the smallest defensible unit: one TS file's worth of
straightforward data-validation tests. The remaining files are tracked
separately.
## Test plan
- [x] \`just test-core\` runs end-to-end and exits 0.
- [x] 3/3 PASS verified locally.
- [x] \`tests/core.test.ts\` deleted; other test files retained.
- [ ] Reviewer: confirm \`just test-core\` works in your environment
(idris2 0.8.0).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ae9a5a0 commit d1c150a
7 files changed
Lines changed: 468 additions & 95 deletions
File tree
- tests
- idris2
- Test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
10 | 17 | | |
11 | 18 | | |
12 | 19 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments