feat: add batch write operations and unit test suite#45
Merged
besart-finsweet merged 5 commits intomasterfrom Apr 17, 2026
Merged
feat: add batch write operations and unit test suite#45besart-finsweet merged 5 commits intomasterfrom
besart-finsweet merged 5 commits intomasterfrom
Conversation
There was a problem hiding this comment.
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 batchedset,update,delete, andcommitvia the Firestore:commitREST endpoint. - Add comprehensive unit tests (Vitest) that run against the Firestore emulator, plus supporting helper utilities and emulator config.
- Add
FIRESTORE_EMULATOR_HOSTsupport toget_firestore_endpointand 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.
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
batch()method for performing multiple writes (set, update, delete) as a single atomic commit via the Firestore REST APIinit,get,create,set,update,remove,query, andbatchget_firestore_endpointviaFIRESTORE_EMULATOR_HOSTenv varChanges
src/batch.ts— newbatch()API withset,update,delete, andcommitmethodssrc/types.ts— addedWrite,CommitRequest,CommitResponse,WriteResulttypessrc/utils.ts— emulator host detection for local development/testingvitest.config.ts+firebase.json+firestore.rules— test infrastructuresrc/*.test.ts+tests/unit/helpers.ts— integration tests for every moduleREADME.md— documented batch API and testing instructions