Skip to content

test(repo): add Deno tests and consolidate types#2

Merged
NeaByteLab merged 1 commit intomainfrom
refactor/repo-standardize-structure
Mar 25, 2026
Merged

test(repo): add Deno tests and consolidate types#2
NeaByteLab merged 1 commit intomainfrom
refactor/repo-standardize-structure

Conversation

@NeaByteLab
Copy link
Owner

Summary

Adds a Deno test suite, consolidates shared types into src/Types.ts, and updates import aliases/config so tests run locally and in CI.

Goals

  • Add automated coverage for core CRUD + query behaviors
  • Replace src/interfaces/ with a single src/Types.ts module
  • Run tests in GitHub Actions CI

Non-Goals

  • Changing the public runtime API semantics
  • Adding new query operators

Changes

  • src/Types.ts: consolidated type exports (replaces src/interfaces/index.ts)
  • src/*: switch imports to @app/ alias and @app/Types.ts
  • tests/jsonary.test.ts: CRUD + query operator + chaining + nested dot-path tests
  • .github/workflows/ci.yaml: add deno test step
  • deno.json: include tests/ for linting and add task test

How To Test

  1. Run deno task check
  2. Run deno task test

Checklist

  • Tests pass locally (deno task test)
  • Typecheck/lint/format pass (deno task check)

@NeaByteLab NeaByteLab self-assigned this Mar 25, 2026
- Add `tests/jsonary.test.ts` for CRUD, query operators, chaining, and nested updates
- Add CI step to run `deno test`
- Move shared types to `src/Types.ts` and update `@app/` imports
- Update `deno.json` test config and tasks
@NeaByteLab NeaByteLab force-pushed the refactor/repo-standardize-structure branch from d03b1dc to f1d9b48 Compare March 25, 2026 08:58
@NeaByteLab
Copy link
Owner Author

🔍 Code Review — PR #2

Walkthrough

This PR adds a Deno test suite for the core Jsonary behaviors, consolidates shared types into src/Types.ts, and standardizes imports via the @app/ alias. CI is updated to run tests so regressions are caught automatically.

Changes

Cohort / File(s) Summary
CI + Config
.github/workflows/ci.yaml, deno.json, build.config.ts
Run tests in CI, include tests/ in linting, and simplify aliasing to @app/.
Runtime
src/index.ts, src/Query.ts, src/Constant.ts
Move types to src/Types.ts, refactor naming for clarity, keep query behavior consistent.
Tests
tests/jsonary.test.ts
Add coverage for CRUD, operators, chaining, reload, and nested dot-path updates.

✅ Safe to Merge

No security or correctness issues that would block merge. CI is green, and the new tests meaningfully cover the query surface.
The items below are small improvements you can do in a follow-up.

Follow-Up Items: 2 | Nitpick Comments: 1


🟡 Follow-Up Recommendations (2)
src/index.ts (1)

💡 Suggestion | 🟡 Minor

src/index.ts:46-51, 122-126: Avoid calling QueryBuilder private methods via bracket access.

Right now deleteWhere and updateWhere use builder['parseCondition'](...) and builder['evaluateCondition'](...). It works, but it weakens encapsulation and makes refactors brittle.

Suggested direction for a follow-up:

  • Expose a small public helper on QueryBuilder (e.g. matches(item, condition) or compile(conditionString)), or
  • Move string-condition evaluation into a shared utility used by both Jsonary and QueryBuilder.
src/Query.ts (1)

💡 Suggestion | 🟡 Minor

src/Query.ts:9-16, 195-216: Consider bounding the static condition cache.

recentConditionCache is a static Map that can grow unbounded with unique condition strings. For long-lived processes that build many distinct queries, this could accumulate.

A simple follow-up could:

  • Cap the cache size (LRU-ish) or
  • Make caching opt-in.

🧹 Nitpick Comments (1)
.github/workflows/ci.yaml (1)

🧹 Nitpick | 🟢 Trivial

.github/workflows/ci.yaml:23-33: Consider using deno task check / deno task test in CI.

This keeps CI aligned with local workflows and reduces duplication between workflow steps and deno.json tasks.


✅ Things Done Well
  • The test suite hits the important behaviors (operators, chaining, nested updates, reload) without relying on external state.
  • The @app/ alias and consolidated Types.ts reduce import churn and make the module layout cleaner.
  • CI running tests is the right guardrail for a library like this.

📊 Summary
Category 🟡 Follow-up 🟢 Nitpick Total
Security 0 0 0
Convention 2 1 3
Frontend 0 0 0
Total 2 1 3

🤖 Prompt for Follow-Up PR With AI Agents
Verify each finding against the current code and only fix it if needed.

Follow-up items:

In @src/index.ts:
- Around lines 46-51 and 122-126: remove bracket-calls to private QueryBuilder methods by exposing a small public API (or extracting shared condition-evaluation utility) that both Jsonary and QueryBuilder can use.

In @src/Query.ts:
- Around lines 9-16 and 195-216: bound or redesign the static `recentConditionCache` to avoid unbounded growth (cap size, LRU, or opt-in caching).

Nitpick items:

In @.github/workflows/ci.yaml:
- Around lines 23-33: consider switching workflow steps to `deno task check` and `deno task test` for consistency.

Automated Review by NeaSwarm

@NeaByteLab NeaByteLab merged commit 3e62759 into main Mar 25, 2026
1 check passed
@NeaByteLab NeaByteLab deleted the refactor/repo-standardize-structure branch March 25, 2026 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant