Add integration tests with disposable MySQL and runtime schema validation#25
Draft
Add integration tests with disposable MySQL and runtime schema validation#25
Conversation
Co-authored-by: mrichards03 <81762014+mrichards03@users.noreply.github.com>
Co-authored-by: mrichards03 <81762014+mrichards03@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Set up unit tests and end-to-end testing with coverage
Add comprehensive testing infrastructure with vitest, Playwright, and CI/CD
Jan 30, 2026
…ation Co-authored-by: mrichards03 <81762014+mrichards03@users.noreply.github.com>
Co-authored-by: mrichards03 <81762014+mrichards03@users.noreply.github.com>
Co-authored-by: mrichards03 <81762014+mrichards03@users.noreply.github.com>
Copilot
AI
changed the title
Add comprehensive testing infrastructure with vitest, Playwright, and CI/CD
Add integration tests with disposable MySQL and runtime schema validation
Jan 31, 2026
…/HEATRobotics/EMBR-Web into copilot/setup-unit-and-e2e-tests
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
Implements full-stack integration testing with testcontainers-managed MySQL and Zod-based runtime schema validation to catch database schema mismatches before production. Tests run against actual DDL from
init.sql, validating the complete data flow from database queries through API responses.Type of Change
📄 Documentation
🧪 Testing
Architecture
Disposable Test Database
server/docker/ddl/init.sqlSchema Validation
Integration Tests
Test Statistics
How Schema Mismatches Are Caught
Three-layer validation catches breaking changes:
Running Tests
CI Pipeline
Integration tests run after unit tests pass, using testcontainers for MySQL. PR blocked if tests fail.
Key Files
Implementation
server/src/schemas/api.schemas.mjs- Zod schemas (Bot, Mission, Temperature, Battery, Position)server/src/middleware/validation.middleware.mjs- Optional response validation middlewareserver/src/__tests__/integration/test-database.mjs- Testcontainers setupserver/src/__tests__/integration/missions.integration.test.mjs- Full mission CRUD testsserver/src/__tests__/schemas.test.mjs- 24 schema validation testsConfiguration
server/vitest.integration.config.mjs- Integration test config (180s timeout).github/workflows/ci-tests.yml- New integration-tests jobSchema Example
Integration Test Pattern
Image of GUI change (if applicable)
N/A - Infrastructure changes only
✅ Pre-Merge Checklist
🧾 Notes (Optional)
Dependencies Added
testcontainers@^11.11.0- Docker container management for testszod@^4.3.6- Runtime schema validationPerformance
Future Enhancements
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.