modernirc
Version:
IRC library for creating modern IRC bots
41 lines (33 loc) • 1.03 kB
JavaScript
import test from 'node:test'
import {
Colors,
color,
bold,
italic,
underline,
strikethrough,
monospace,
hexColor,
} from '../lib/index.js'
test('colorize a text', (t) => {
t.assert.deepEqual(color('hello world', Colors.Red), '\x0304hello world\x03')
t.assert.deepEqual(color('hello world', Colors.Red, Colors.Blue), '\x0304,02hello world\x03')
})
test('bolden a text', (t) => {
t.assert.deepEqual(bold('hello world'), '\x02hello world\x02')
})
test('italic a text', (t) => {
t.assert.deepEqual(italic('hello world'), '\x1Dhello world\x1D')
})
test('underline a text', (t) => {
t.assert.deepEqual(underline('hello world'), '\x1Fhello world\x1F')
})
test('strike a text', (t) => {
t.assert.deepEqual(strikethrough('hello world'), '\x1Ehello world\x1E')
})
test('force monospace for text', (t) => {
t.assert.deepEqual(monospace('hello world'), '\x11hello world\x11')
})
test('rgb colorize a text', (t) => {
t.assert.deepEqual(hexColor('hello world', 'FF00FF'), '\x04FF00FFhello world\x04')
})