Skip to content

feat: add batch write operations and unit test suite#45

Merged
besart-finsweet merged 5 commits intomasterfrom
feat/batch-and-unit-tests
Apr 17, 2026
Merged

feat: add batch write operations and unit test suite#45
besart-finsweet merged 5 commits intomasterfrom
feat/batch-and-unit-tests

Conversation

@besart-finsweet
Copy link
Copy Markdown
Contributor

@besart-finsweet besart-finsweet commented Apr 16, 2026

Summary

  • Add batch() method for performing multiple writes (set, update, delete) as a single atomic commit via the Firestore REST API
  • Add unit test suite (47 tests) using Vitest + Firebase Emulator covering all existing modules: init, get, create, set, update, remove, query, and batch
  • Add emulator support in get_firestore_endpoint via FIRESTORE_EMULATOR_HOST env var

Changes

  • src/batch.ts — new batch() API with set, update, delete, and commit methods
  • src/types.ts — added Write, CommitRequest, CommitResponse, WriteResult types
  • src/utils.ts — emulator host detection for local development/testing
  • vitest.config.ts + firebase.json + firestore.rules — test infrastructure
  • src/*.test.ts + tests/unit/helpers.ts — integration tests for every module
  • README.md — documented batch API and testing instructions

@besart-finsweet besart-finsweet marked this pull request as draft April 16, 2026 21:01
Copy link
Copy Markdown

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

Adds a Firestore REST “write batch” API and introduces a Vitest + Firebase Emulator-based unit test suite, while also improving local/emulator endpoint support for Firestore requests.

Changes:

  • Add batch() API supporting batched set, update, delete, and commit via the Firestore :commit REST endpoint.
  • Add comprehensive unit tests (Vitest) that run against the Firestore emulator, plus supporting helper utilities and emulator config.
  • Add FIRESTORE_EMULATOR_HOST support to get_firestore_endpoint and wire CI to run typecheck + unit tests.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vitest.config.ts Configures Vitest to run node-based unit tests sequentially with emulator env vars.
tsconfig.json Expands TS includes to cover tests and Vitest config for typechecking.
tests/unit/helpers.ts Adds shared test helpers for initializing DB + clearing the emulator.
src/utils.ts Adds emulator host support to Firestore endpoint construction.
src/types.ts Introduces commit/batch-related REST types (Write, CommitRequest, etc.).
src/batch.ts Implements the new batch() API and commit logic.
src/index.ts Exports batch from the package entry point.
src/*.test.ts Adds emulator-backed unit tests for all modules (init/get/create/set/update/remove/query/batch).
package.json Adds unit-test scripts and dev deps for vitest + firebase-tools.
firebase.json Adds Firestore emulator configuration (host/port + UI).
firestore.rules Adds permissive rules for emulator testing.
.firebaserc Sets a default local project id for emulator usage.
.github/workflows/ci.yml Adds Typecheck + Unit-Tests jobs to CI workflow.
README.md Documents the new batch API and how to run unit tests.
.changeset/lazy-trees-lie.md Declares a minor release for the new feature/test suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml
Comment thread src/utils.ts Outdated
Comment thread src/batch.ts
Comment thread package.json Outdated
Copy link
Copy Markdown

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 21 out of 23 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/batch.ts Outdated
Copy link
Copy Markdown
Member

@alexiglesias93 alexiglesias93 left a comment

Choose a reason for hiding this comment

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

looks great!

@besart-finsweet besart-finsweet merged commit 7c8bc38 into master Apr 17, 2026
3 checks passed
@besart-finsweet besart-finsweet deleted the feat/batch-and-unit-tests branch April 17, 2026 15:39
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.

3 participants