File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from 'vitest' ;
2+ import {
3+ formatTooltipDate ,
4+ getActivityInsight ,
5+ getContributionLabel ,
6+ getLocalActiveStreak ,
7+ getStreakLabel ,
8+ } from './tooltipUtils' ;
9+
10+ describe ( 'tooltipUtils empty fallback behavior' , ( ) => {
11+ it ( 'returns original value for empty or invalid tooltip dates' , ( ) => {
12+ expect ( formatTooltipDate ( '' ) ) . toBe ( '' ) ;
13+ expect ( formatTooltipDate ( 'invalid-date' ) ) . toBe ( 'invalid-date' ) ;
14+ } ) ;
15+
16+ it ( 'formats zero contributions with plural fallback label' , ( ) => {
17+ expect ( getContributionLabel ( 0 ) ) . toBe ( '0 contributions' ) ;
18+ } ) ;
19+
20+ it ( 'returns no activity insight for zero count without intensity' , ( ) => {
21+ expect ( getActivityInsight ( 0 ) ) . toBe ( 'No activity recorded' ) ;
22+ } ) ;
23+
24+ it ( 'returns zero local active streak for empty activity data' , ( ) => {
25+ expect ( getLocalActiveStreak ( [ ] , 0 ) ) . toBe ( 0 ) ;
26+ } ) ;
27+
28+ it ( 'returns no active streak label for zero or negative streaks' , ( ) => {
29+ expect ( getStreakLabel ( 0 ) ) . toBe ( 'No active streak' ) ;
30+ expect ( getStreakLabel ( - 1 ) ) . toBe ( 'No active streak' ) ;
31+ } ) ;
32+ } ) ;
You can’t perform that action at this time.
0 commit comments