MetaMask / MetaMask/metamask-design-system

Improve test coverage for `Blockies.utilities.ts`

Open
#700 0 comments 0 reactions 0 assignees View on GitHub
team-design-system
Dominant language
TypeScript
Stars
37
Forks
14
Avg merge
1d 9h
Merged PRs (30d)
60

Description

### **Description**

Improve test coverage for `Blockies.utilities.ts` to achieve 100% coverage across all metrics (statements, branches, and lines). Currently, the file has gaps in test coverage that need to be addressed to ensure comprehensive testing of all code paths and edge cases.

### **Technical Details**

- Current coverage metrics for `Blockies.utilities.ts`:
- Statements: 96.11% (target: 100%)
- Branches: 82.05% (target: 100%)
- Lines: 95.81% (target: 100%)
- Uncovered lines: 407, 448-450, 558
- The Jest coverage threshold is set to 100% for all metrics, causing the build to fail
- Need to identify and test uncovered code paths, particularly conditional branches
- Focus on edge cases and error handling scenarios that may not be currently tested

### **Acceptance Criteria**

- [ ] Achieve 100% statement coverage for `Blockies.utilities.ts`
- [ ] Achieve 100% branch coverage for `Blockies.utilities.ts`
- [ ] Achieve 100% line coverage for `Blockies.utilities.ts`
- [ ] All Jest coverage thresholds should pass
- [ ] New tests should cover edge cases and error conditions
- [ ] Tests should be meaningful and not just coverage-driven (avoid trivial tests)
- [ ] Existing functionality should remain unaffected
- [ ] Test suite should run without warnings or errors

### **References**

- Test coverage report showing current gaps in `Blockies.utilities.ts`
- Jest configuration with 100% coverage thresholds
- Related to overall design system testing infrastructure improvements

Contributor guide

Open the contributing guide

Research direction

Start with the coverage report for Blockies.utilities.ts and the Jest configuration, then run the existing Jest tests to reproduce the uncovered lines 407, 448-450, and 558. Inspect the current tests and add meaningful cases for the missing branches, edge cases, and error conditions. Done means 100% statement, branch, and line coverage with all Jest thresholds passing and no warnings or errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.