Skip to content

Add tests for router, store, and view modules#14

Merged
JosunLP merged 10 commits intodevelopmentfrom
feature/store-router-view
Jan 24, 2026
Merged

Add tests for router, store, and view modules#14
JosunLP merged 10 commits intodevelopmentfrom
feature/store-router-view

Conversation

@JosunLP
Copy link
Copy Markdown
Collaborator

@JosunLP JosunLP commented Jan 24, 2026

This pull request introduces comprehensive documentation and README updates for three major new modules in the project: Router, Store, and View. These changes provide users with detailed usage guides, API references, and examples for each module, and integrate them into the main documentation and project overview.

Major documentation additions and updates:

Router, Store, and View documentation:

  • Added new detailed guide pages for the Router (docs/guide/router.md) and Store (docs/guide/store.md) modules, covering setup, API, usage examples, and type references. [1] [2]
  • Updated the documentation navigation and README to include Router, Store, and View modules in module listings, quick examples, and directory structure. [1] [2] [3] [4] [5] [6]

Changelog and release notes:

  • Expanded the CHANGELOG.md with a new section for version 1.2.0, summarizing the addition of the Router, Store, and View modules and their key features.

These updates ensure that developers have clear guidance and reference material for using the new SPA routing, state management, and declarative DOM binding features.

JosunLP and others added 5 commits January 24, 2026 01:02
Security and Playground Fixes:
* Replaced direct assignment of HTML via `innerHTML` with safer DOM manipulation in the `logEvent` function within `playground/src/demos/core.ts` to prevent possible HTML injection vulnerabilities.
* Updated collection handling in the same file to use the raw DOM element when re-appending items, improving code clarity and safety.

Workflow and Versioning:
* Added explicit `contents: read` permissions to both `build` and `build-docs` jobs in `.github/workflows/npm-publish.yml` to comply with GitHub Actions best practices. [[1]](diffhunk://#diff-8a5ce8b612395836520d0655143f732d08e747af57f3cfe76b5e283600106240R16-R17) [[2]](diffhunk://#diff-8a5ce8b612395836520d0655143f732d08e747af57f3cfe76b5e283600106240R29-R30)
* Bumped package version to `1.1.1` in `package.json` to reflect the new release.
* Added a changelog entry for version `1.1.1` noting the HTML handling fix in `CHANGELOG.md`.
… new modules

- Created `router.test.ts` to test router module exports and functionality.
- Created `store.test.ts` to test store creation, state management, actions, and persistence.
- Created `view.test.ts` to test view rendering, directives, and template creation.
- Updated `vite.config.ts` to include new router, store, and view modules for bundling.
@JosunLP JosunLP self-assigned this Jan 24, 2026
Copilot AI review requested due to automatic review settings January 24, 2026 15:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request introduces three major new modules to bQuery.js: Router (SPA client-side routing), Store (signal-based state management), and View (declarative DOM bindings). However, there's a significant discrepancy: the PR title states "Add tests for router, store, and view modules" but the changes include full implementations of these modules, comprehensive test suites, and extensive documentation updates.

Changes:

  • Three new feature modules with complete TypeScript implementations (~2,000+ lines of code)
  • Comprehensive test suites for Store and View modules; minimal tests for Router
  • Full documentation guides for all three modules
  • Updated README, CHANGELOG, build configuration, and package.json

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
src/router/index.ts New SPA router implementation with History API, route matching, guards (673 lines)
src/store/index.ts New Pinia-style state management with signals, getters, actions (640 lines)
src/view/index.ts New declarative DOM binding system with Vue/Alpine-style directives (710 lines)
tests/router.test.ts Minimal export verification tests only - needs expansion
tests/store.test.ts Comprehensive store tests covering all features
tests/view.test.ts Comprehensive view tests covering all directives
vite.config.ts Added build entries for new modules
package.json Version bump to 1.2.0, added module exports
src/index.ts, src/full.ts Export new modules
docs/guide/router.md Complete router documentation with examples
docs/guide/store.md Complete store documentation with examples
docs/guide/view.md Complete view documentation with examples
docs/.vitepress/config.ts Added navigation links for new guides
README.md Added module descriptions and usage examples
CHANGELOG.md Detailed 1.2.0 release notes

…pport

- Updated the query parameter structure to support multi-value keys, allowing duplicate query parameters to be stored as arrays.
- Enhanced the `parseQuery` function to correctly handle and return multi-value query parameters.
- Added tests to verify the correct parsing of single and multiple query parameters, including edge cases with duplicates.

feat(signal): add peek method to Computed class

- Introduced a `peek` method in the `Computed` class to read the current computed value without tracking dependencies.
- This method allows access to the cached value while avoiding unnecessary reactivity.

feat(store): implement state proxy for lazy signal reading

- Created a state proxy using `Proxy` to lazily read signal values, improving performance by avoiding unnecessary object creation.
- Updated the `getCurrentState` method to return a shallow copy of the state for subscriber notifications.

fix(view): add security warnings for dynamic expression evaluation

- Added security considerations to the view module regarding the use of `new Function()` for evaluating expressions.
- Emphasized the importance of using trusted sources for expressions to mitigate security risks.

test(router): implement comprehensive router tests with mocked history

- Developed a suite of tests for the router module, including route matching, parameter extraction, query string parsing, and navigation functionality.
- Mocked the History API to facilitate testing in environments without full browser support.

test(store): update store tests to skip localStorage tests if not available

- Modified store tests to conditionally skip tests that require localStorage when it is not available, improving test reliability across environments.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.

…mples

test(signal): add tests for peek functionality in computed signals
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated no new comments.

@JosunLP JosunLP merged commit b8f24de into development Jan 24, 2026
5 checks passed
@JosunLP JosunLP deleted the feature/store-router-view branch January 24, 2026 16:48
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.

2 participants