| 1 |
import test from 'ava'; |
| 2 |
import stripAnsi from 'strip-ansi'; |
| 3 |
import logSymbols from './index.js'; |
| 4 |
|
| 5 |
const symbols = Object.entries(logSymbols) |
| 6 |
.map(([key, value]) => `${value} ${key}`) |
| 7 |
.join('\n'); |
| 8 |
|
| 9 |
test('returns log symbols', t => { |
| 10 |
t.true(stripAnsi(logSymbols.info) === 'ℹ' || stripAnsi(logSymbols.info) === 'i'); |
| 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); |
| 27 |
}); |