File tree Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Expand file tree Collapse file tree 2 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -11,4 +11,4 @@ const _isUnicodeSupported = isUnicodeSupported();
11
11
export const info = blue ( _isUnicodeSupported ? 'ℹ' : 'i' ) ;
12
12
export const success = green ( _isUnicodeSupported ? '✔' : '√' ) ;
13
13
export const warning = yellow ( _isUnicodeSupported ? '⚠' : '‼' ) ;
14
- export const error = red ( _isUnicodeSupported ? '✖️ ' : '×' ) ;
14
+ export const error = red ( _isUnicodeSupported ? '✖' : '×' ) ;
Original file line number Diff line number Diff line change @@ -2,12 +2,26 @@ import test from 'ava';
2
2
import stripAnsi from 'strip-ansi' ;
3
3
import logSymbols from './index.js' ;
4
4
5
- for ( const [ key , value ] of Object . entries ( logSymbols ) ) {
6
- console . log ( value , key ) ;
7
- }
8
-
9
- console . log ( '' ) ;
5
+ const symbols = Object . entries ( logSymbols )
6
+ . map ( ( [ key , value ] ) => `${ value } ${ key } ` )
7
+ . join ( '\n' ) ;
10
8
11
9
test ( 'returns log symbols' , t => {
10
+ t . true ( stripAnsi ( logSymbols . info ) === 'ℹ' || stripAnsi ( logSymbols . info ) === 'i' ) ;
12
11
t . true ( stripAnsi ( logSymbols . success ) === '✔' || stripAnsi ( logSymbols . success ) === '√' ) ;
12
+ t . true ( stripAnsi ( logSymbols . warning ) === '⚠' || stripAnsi ( logSymbols . warning ) === '‼' ) ;
13
+ t . true ( stripAnsi ( logSymbols . error ) === '✖' || stripAnsi ( logSymbols . error ) === '×' ) ;
14
+ t . log ( symbols ) ;
15
+ } ) ;
16
+
17
+ test ( 'confirms Unicode code point for log symbols' , t => {
18
+ const infoCodePoint = stripAnsi ( logSymbols . info ) . codePointAt ( 0 ) ;
19
+ const successCodePoint = stripAnsi ( logSymbols . success ) . codePointAt ( 0 ) ;
20
+ const warningCodePoint = stripAnsi ( logSymbols . warning ) . codePointAt ( 0 ) ;
21
+ const errorCodePoint = stripAnsi ( logSymbols . error ) . codePointAt ( 0 ) ;
22
+
23
+ t . true ( infoCodePoint === 8505 || infoCodePoint === 105 ) ;
24
+ t . true ( successCodePoint === 10_004 || successCodePoint === 8730 ) ;
25
+ t . true ( warningCodePoint === 9888 || warningCodePoint === 8252 ) ;
26
+ t . true ( errorCodePoint === 10_006 || errorCodePoint === 215 ) ;
13
27
} ) ;
You can’t perform that action at this time.
0 commit comments