File tree 2 files changed +19
-5
lines changed
2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -89,11 +89,11 @@ h.prettyTime = function(n) {
89
89
90
90
h . prettyLevel = function ( level ) {
91
91
var chalk = require ( './chalk' ) ;
92
- switch ( level ) {
93
- case 'Easy ' : return chalk . green ( 'Easy ') ;
94
- case 'Medium ' : return chalk . yellow ( 'Medium' ) ;
95
- case 'Hard ' : return chalk . red ( 'Hard ') ;
96
- default : return ' ' ;
92
+ switch ( level . toLowerCase ( ) ) {
93
+ case 'easy ' : return chalk . green ( level + ' ') ;
94
+ case 'medium ' : return chalk . yellow ( level ) ;
95
+ case 'hard ' : return chalk . red ( level + ' ') ;
96
+ default : return level ;
97
97
}
98
98
} ;
99
99
Original file line number Diff line number Diff line change @@ -46,6 +46,20 @@ describe('helper', function() {
46
46
} ) ;
47
47
} ) ; // #prettyText
48
48
49
+ describe ( '#prettyLevel' , function ( ) {
50
+ it ( 'should ok w/ color' , function ( ) {
51
+ chalk . enabled = true ;
52
+
53
+ assert . equal ( h . prettyLevel ( 'Easy' ) , chalk . green ( 'Easy ' ) ) ;
54
+ assert . equal ( h . prettyLevel ( 'Medium' ) , chalk . yellow ( 'Medium' ) ) ;
55
+ assert . equal ( h . prettyLevel ( 'Hard' ) , chalk . red ( 'Hard ' ) ) ;
56
+ assert . equal ( h . prettyLevel ( 'easy' ) , chalk . green ( 'easy ' ) ) ;
57
+ assert . equal ( h . prettyLevel ( 'medium' ) , chalk . yellow ( 'medium' ) ) ;
58
+ assert . equal ( h . prettyLevel ( 'hard' ) , chalk . red ( 'hard ' ) ) ;
59
+ assert . equal ( h . prettyLevel ( 'unknown' ) , 'unknown' ) ;
60
+ } ) ;
61
+ } ) ; // #prettyLevel
62
+
49
63
describe ( '#prettySize' , function ( ) {
50
64
it ( 'should ok' , function ( ) {
51
65
assert . equal ( h . prettySize ( 0 ) , '0.00B' ) ;
You can’t perform that action at this time.
0 commit comments