Skip to content

Add unit tests and CI/CD workflow#10

Merged
ziemniak04 merged 3 commits intodevelopfrom
feature/add-tests
Jan 11, 2026
Merged

Add unit tests and CI/CD workflow#10
ziemniak04 merged 3 commits intodevelopfrom
feature/add-tests

Conversation

@ziemniak04
Copy link
Copy Markdown
Collaborator

@ziemniak04 ziemniak04 commented Jan 10, 2026

User description

  • Add Jest/React Testing Library setup
  • Add tests for:
    • Redux auth slice (login, logout, state transitions)
    • Redux store configuration
    • Firebase authentication (sign in, sign up, sign out)
    • Firestore operations (doc, setDoc, getDoc)
    • Firebase configuration validation
    • Button component
    • Input component
  • Add Firebase mocks for testing
  • Add GitHub Actions workflow to run tests on PRs
  • Workflow blocks merge if tests don't pass 90% threshold
  • Add test:ci script for CI environments

Total: 83 tests across 7 test suites


PR Type

Tests, Enhancement


Description

  • Add comprehensive Jest/React Testing Library test suite with 83 tests

  • Create Firebase mocks for authentication and Firestore operations

  • Implement GitHub Actions CI/CD workflow with 90% pass rate quality gate

  • Add test configuration and environment setup for CI environments


Diagram Walkthrough

flowchart LR
  A["Test Setup"] --> B["Firebase Mocks"]
  A --> C["Component Tests"]
  A --> D["Redux Tests"]
  A --> E["Firebase Tests"]
  B --> F["Auth Functions"]
  B --> G["Firestore Operations"]
  C --> H["Button & Input"]
  D --> I["Auth Slice & Store"]
  E --> J["Auth & Config Tests"]
  F --> K["GitHub Actions"]
  G --> K
  H --> K
  I --> K
  J --> K
  K --> L["Quality Gate 90%"]
  L --> M["Block Merge if Failed"]
Loading

File Walkthrough

Relevant files
Tests
8 files
firebase.js
Firebase authentication and Firestore operation mocks       
+96/-0   
Button.test.js
Button component unit tests with variants                               
+56/-0   
Input.test.js
Input component unit tests with types                                       
+70/-0   
auth.test.js
Firebase authentication functions test suite                         
+180/-0 
firebaseConfig.test.js
Firebase configuration and environment validation               
+121/-0 
firestore.test.js
Firestore document operations test suite                                 
+161/-0 
authSlice.test.js
Redux auth slice reducer and selectors tests                         
+151/-0 
store.test.js
Redux store configuration and integration tests                   
+90/-0   
Configuration changes
3 files
setupTests.js
Jest test environment setup and global mocks                         
+41/-0   
.env.test
Test environment variables for Firebase config                     
+10/-0   
test.yml
GitHub Actions CI/CD workflow with quality gates                 
+152/-0 
Dependencies
1 files
package.json
Add test dependencies and test:ci script                                 
+17/-0   

- Add Jest/React Testing Library setup
- Add tests for:
  - Redux auth slice (login, logout, state transitions)
  - Redux store configuration
  - Firebase authentication (sign in, sign up, sign out)
  - Firestore operations (doc, setDoc, getDoc)
  - Firebase configuration validation
  - Button component
  - Input component
- Add Firebase mocks for testing
- Add GitHub Actions workflow to run tests on PRs
- Workflow blocks merge if tests don't pass 90% threshold
- Add test:ci script for CI environments

Total: 83 tests across 7 test suites
Repository owner deleted a comment from qodo-code-review bot Jan 10, 2026
…culation

- Changed npm ci to npm install to avoid package-lock sync issues
- Fixed bash regex parsing (removed -P flag not available on Ubuntu)
- Simplified workflow to single test job with quality gate check
- Use awk instead of bc for arithmetic operations
- Fixed quality gate job to properly check needs.test.result
- Import Button and Input directly from their folders instead of barrel export
- Barrel export (components/index.js) triggers Firebase init via Layout/Navbar
- All 83 tests now pass
@ziemniak04 ziemniak04 added enhancement New feature or request and removed Review effort 3/5 labels Jan 10, 2026
Repository owner deleted a comment from qodo-code-review bot Jan 10, 2026
@ziemniak04 ziemniak04 merged commit 52c1449 into develop Jan 11, 2026
3 checks passed
@quangptt0910 quangptt0910 deleted the feature/add-tests branch February 23, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant