feat: enhance snapshot testing for ProjectIcon and ContactBulkActions
Apply comprehensive snapshot testing improvements to ProjectIcon and ContactBulkActions components, matching the enhanced validation pattern established for RegistrationNotice and LargeIdenticonModal.
- ProjectIcon: Add specific structure validation with regex patterns, conditional rendering tests for different prop combinations (imageUrl, linkToFullImage), accessibility structure validation, and SVG structure verification
- ContactBulkActions: Add specific structure validation with regex patterns, conditional rendering tests for showGiveNumbers prop, accessibility attribute validation, and form control verification
- Fix conditional rendering logic to properly test Vue v-if behavior for both components
- Add comprehensive prop combination testing covering all rendering scenarios
- Maintain accessibility attribute validation where implemented (data-testid, SVG xmlns)
Improves component reliability with realistic validation that matches actual component structure and behavior, ensuring consistent testing quality across all simple components.
The primary purpose of our comprehensive error handling tests is to **prevent component and system failures** in real-world scenarios. Our testing philosophy focuses on:
#### **1. Real-World Edge Case Protection**
- **Invalid API responses**: Test components when backend returns `null` instead of expected objects
- **Network failures**: Verify graceful handling of missing or corrupted data
- **User input errors**: Test with malformed data, special characters, and extreme values
- **Concurrent operations**: Ensure stability during rapid state changes and simultaneous interactions
#### **2. System Stability Assurance**
- **Cascading failures**: Prevent one component's error from breaking the entire application
- **Memory leaks**: Ensure components clean up properly even when errors occur
- **Performance degradation**: Verify components remain responsive under error conditions
#### **3. Production Readiness**
- **User Experience Protection**: Users don't see blank screens or error messages
- **Developer Confidence**: Safe refactoring without fear of breaking edge cases
- **System Reliability**: Prevents one bad API response from crashing the entire app
### **Comprehensive Error Scenarios**
Our error handling tests cover:
#### **RegistrationNotice Component Protection**
- Prevents crashes when `isRegistered` or `show` props are malformed
- Ensures the "Share Your Info" button still works even with invalid data
- Protects against rapid prop changes causing UI inconsistencies
#### **LargeIdenticonModal Component Protection**
- Prevents modal rendering with invalid contact data that could break the UI
- Ensures the close functionality works even with malformed contact objects
- Protects against EntityIcon component failures cascading to the modal
### **Error Testing Categories**
#### **Invalid Input Testing**
```typescript
// Test 10+ different invalid prop combinations
const invalidPropCombinations = [
null, undefined, 'invalid', 0, -1, {}, [],
() => {}, NaN, Infinity
]
```
#### **Malformed Data Testing**
```typescript
// Test various malformed data structures
const malformedData = [
{ id: 'invalid' }, { name: null },
{ id: 0, name: '' }, { id: NaN, name: NaN }
]
```
#### **Extreme Value Testing**
```typescript
// Test boundary conditions and extreme values
const extremeValues = [
Number.MAX_SAFE_INTEGER, Number.MIN_SAFE_INTEGER,
Infinity, NaN, '', '\t\n\r'
]
```
#### **Concurrent Error Testing**
```typescript
// Test rapid changes with invalid data
for (let i = 0; i <50;i++){
await wrapper.setProps({
contact: i % 2 === 0 ? null : malformedContact
})
}
```
### **Benefits Beyond Coverage**
#### **1. Defensive Programming Validation**
- Components handle unexpected data gracefully
- No crashes or blank screens for users
- Proper error boundaries and fallbacks
#### **2. Real-World Resilience**
- Tested against actual failure scenarios
- Validated with realistic error conditions
- Proven stability under adverse conditions
#### **3. Developer Confidence**
- Safe to refactor and extend components
- Clear understanding of component behavior under stress