feat(tests): add Jest tests, mocks, and per-script test discovery - #2
Conversation
don-petry
left a comment
There was a problem hiding this comment.
Summary: Nice work — this adds a solid testing foundation, portable mocks for Apps Script services, and a CI workflow that discovers per-script tests. I ran the test suite locally and the CI job on this PR passed.\n\nSuggestions (non-blocking):\n1) Mocks: In , uses an arrow function for which references and may not refer to the thread object as intended; change it to capture the thread variable or use a normal function. Consider adding lightweight spies (e.g., increment counters or expose ) so tests can assert that labels were removed/added and files were created.\n\n2) Workflow: Add caching for npm () and use
added 266 packages, and audited 267 packages in 5s
32 packages are looking for funding
run npm fund for details
found 0 vulnerabilities to ensure reproducible installs; consider guarding the matrix in case no packages with tests are present to avoid a matrix with 0 entries.\n\n3) Jest config & tests: Consider enabling coverage collection and adding coverage thresholds in . Also add tests that exercise deduplication behavior (same filename with different content) and consider porting more logic from into so flow-level tests can assert label handling and Drive/Doc interactions.\n\n4) Repo hygiene: Add / fields to and, if you prefer deterministic installs, keeping is fine—just be aware of maintenance.\n\nIf you'd like, I can open follow-up PRs to: (A) add spies to mocks, (B) add coverage config and extra tests, and (C) add caching to the workflow. Let me know which you'd like me to do next.
* docs: add AI-Powered Gemini Semantic Classifier feature proposal * docs: update proposal with 7-Domain Standard Taxonomy Matrix & MECE Validation * docs: add Inbox Preservation rule (processing to Drive does NOT remove from INBOX) * docs: use Single Global Processed Label marker to eliminate sidebar label duplication * docs: detail Idempotency & Single-Click Reprocessing workflows * feat: add native Gemini AI classifier and auto-filter engine module * chore: dev-lead update (review-changes) [skip ci-relay] * chore: dev-lead update (review-changes) [skip ci-relay] * chore: dev-lead update (review-changes) [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * chore: dev-lead update (review-changes) [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * fix(reviews): address review comments [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * fix(ci): auto-fix for SonarCloud Code Analysis [skip ci-relay] * docs: detail Unclassified & Edge-Case email handling safety nets * feat: add native Google Apps Script GitHub Sync module (UrlFetchApp -> GitHub REST API) * chore(ci): apply prettier/eslint auto-fixes * fix(bot): address bot feedback [skip ci-relay] * fix(bot): address bot feedback [skip ci-relay] * test: add performance and scalability benchmark test suite for long documents and SHA retries * feat: enhance gitHubSync with targeted insertion and 409 SHA collision retries * chore: dev-lead update (review-changes) [skip ci-relay] * feat: add Option A multi-account user email resolution and deployment guide * chore(ci): apply prettier/eslint auto-fixes * feat: add modelEndpoint to classifier config The classifyEmailWithGemini function requires config.modelEndpoint to be defined, but it was missing from the returned config object in getClassifierConfig(). Added the Gemini 1.5 Flash model endpoint to resolve the configuration dependency. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com> * feat: add appsscript.json manifest for clasp deployment * chore: add .claspignore to exclude Node.js Jest test files from Apps Script runtime * fix: export getAiClassifierConfig and standalone GAS logic * fix: safe Gemini API HTTP status checking and response guards * fix: update Gemini API endpoint to gemini-2.0-flash with automatic fallbacks * feat: add listAvailableGeminiModels helper and expanded model endpoints * feat: set gemini-3.1-flash-lite as 2nd fallback endpoint * feat: add 404 auto-create note functionality with Progressive Disclosure front-matter * feat: reorder endpoints to highest-level model first and add HTTP 429 failover * feat: set Gemini 3.5 Flash Lite as primary endpoint #1 * feat: set Gemini 3.5 Flash Lite as #1 and Gemini 3.1 Flash Lite as #2 * chore: remove deprecated 1.x and 2.x Gemini models, use 3.x models only * chore: dev-lead update (review-changes) [skip ci-relay] * feat: add Family/DJ-Rachel sub-label and strict prompt classification rules * feat: exclude health newsletters and news bulletins from 04_Family_Health * feat: add setupFiveMinuteTrigger and stopAllTriggers for automated background classification * feat: map student college/career planning meetings to Family/School * feat: map MyBroodMinder alerts to 07_Community_NonProfit with sub-label Projects/Beekeeping * feat: map ParentSquare and MCAA school emails to Family/School-Toby * fix: add 2-second rate limit backoff delay on HTTP 429 and stabilize model endpoints * feat: parse and honor Retry-After header and retryDelay on HTTP 429 * chore: strictly enforce Gemini 3.x models ONLY * feat: add Gemma 4 31B (gemma-4-31b-it) as primary endpoint #1 * fix: add extractJsonSubstring helper to parse Gemma 4 31B markdown formatting * feat: exclude tech webinars and commercial store marketing from core domain tags * feat: add automated action execution (trash, archive, mark_read) and Gmail category routing --------- Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Adds Jest-based unit testing for Google Apps Script logic, including portable mocks for common GAS services (GmailApp, DriveApp, DocumentApp), per-script test discovery, and example tests for the 'gmail-to-drive-by-labels' script.\n\nThe workflow file has been added to this branch; CI should run automatically and report the 'Node.js Tests' check on this PR.