Skip to content

Add unit tests and documentation for nodeBook parser and renderer #4

Description

@gnowgi

Summary

The nodeBook parser (cnl-parser.ts), operations pipeline (operations-to-graph.ts), and renderer (nodebook-graph.tsx) currently have no unit test coverage. Adding tests is critical before building new features on top of the existing infrastructure.

Test Coverage Needed

Parser (cnl-parser.ts)

  • Heading parsing: # Name [Type], # **adj** Name [Type], simple headings
  • Relation parsing: <relation> target;, multi-target, weighted arcs
  • Attribute parsing: values with *unit*, *quantifier*, ++adverb++, [modality]
  • Mindmap parsing: # Topic <relation> + - item bullets
  • Accounting relations: <debit>has post_state, <credit>has prior_state
  • Currency directive: currency: USD;
  • Edge cases: empty input, malformed headings, missing semicolons

Operations Pipeline (operations-to-graph.ts)

  • Three-pass processing: nodes → morphs → edges/attributes
  • Morph creation and linkage
  • Duplicate node deduplication
  • Graph mode detection (mindmap / petri-net / concept-map)

Renderer (nodebook-graph.tsx)

  • Snapshot tests for Cytoscape element generation per mode
  • Token simulation: initial marking, firing rules, deadlock detection
  • Accounting mode: balance computation, equation display, auto-fire

Schema Validation (validate-operations.ts)

  • Valid/invalid node types, relation types, attribute types
  • User schema overrides via nodeBook-schema

Documentation

  • Write tutorials for each graph mode (see sibling issues)
  • Document CNL syntax extensions beyond the cheatsheet
  • Architecture guide for contributors

Priority

High — prerequisite for safe feature development.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationnodeBooknodeBook extension features

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions