File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 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) {
8989
9090h . prettyLevel = function ( level ) {
9191 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 ;
9797 }
9898} ;
9999
Original file line number Diff line number Diff line change @@ -46,6 +46,20 @@ describe('helper', function() {
4646 } ) ;
4747 } ) ; // #prettyText
4848
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+
4963 describe ( '#prettySize' , function ( ) {
5064 it ( 'should ok' , function ( ) {
5165 assert . equal ( h . prettySize ( 0 ) , '0.00B' ) ;
You can’t perform that action at this time.
0 commit comments