Skip to content

Latest commit

 

History

History
86 lines (62 loc) · 2.73 KB

File metadata and controls

86 lines (62 loc) · 2.73 KB

Test Suite Summary

Overview

This test suite validates the addition of the noise-aware-qnn-identifiability repository and the Identifiability metrics method to the portfolio website.

Test Results

✅ All 8 tests passing

Test Cases

1. Repository Data Validation

Test: noise-aware-qnn-identifiability repository is correctly added to the list

Validates:

  • Repository exists with correct ID
  • Title: "Noise-Aware QNN Identifiability"
  • URL points to correct GitHub repository
  • Short description matches expected text
  • All 4 methods are present in the methods array
  • Tags array contains: ['Quantum ML', 'Identifiability', 'Noise', 'Verification']
  • Finding contains key correlation data
  • Long description contains required content

2. Methods Array Validation

Test: Identifiability metrics method is correctly added to the list

Validates:

  • 'Identifiability metrics' exists in the methods array
  • It appears in the correct position (7th item)
  • Full methods array structure is correct with all 7 methods

3. Filtering Function Tests

Test Suite: getFilteredRepositories Function

6 comprehensive tests covering:

  1. Basic filtering - Selecting 'Identifiability metrics' returns only the noise-aware-qnn-identifiability repository
  2. No filter - Returns all repositories when no method is selected
  3. Non-matching filter - Returns empty array for non-existent methods
  4. Combined filters - Works correctly with tag filters
  5. Filter conflicts - Returns empty when filters don't match
  6. Search integration - Works correctly with search terms

Running the Tests

# Install dependencies
npm install

# Run tests
npm test

# Run with coverage
npm run test:coverage

# Watch mode for development
npm run test:watch

Test Implementation

  • Framework: Jest 29.7.0
  • Environment: jsdom (browser simulation)
  • Test File: __tests__/repositories.test.js
  • Total Tests: 8
  • Test Suites: 1

Files Created

  1. package.json - Node.js project configuration with Jest
  2. jest.config.js - Jest configuration for jsdom environment
  3. __tests__/repositories.test.js - Main test file with all test cases
  4. __tests__/README.md - Test documentation
  5. Updated .gitignore - Added node_modules and coverage directories

Coverage

The tests validate the data structure and filtering logic by:

  • Parsing script.js to extract repositories and methods arrays
  • Extracting and executing the getFilteredRepositories function
  • Mocking global state variables (searchTerm, selectedTags, selectedMethod)
  • Running assertions against the actual data and filtering behavior

This ensures the website correctly displays and filters the new repository when users interact with the method filters.