1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-03 17:08:35 -05:00
denoland-deno/colors/test.ts

22 lines
607 B
TypeScript
Raw Normal View History

2019-01-19 05:09:35 -05:00
import { assert, test } from "../testing/mod.ts";
import { red, bgBlue, setEnabled, getEnabled } from "./mod.ts";
2019-01-10 20:18:21 -05:00
import "./example.ts";
2018-12-18 23:30:44 -05:00
test(function singleColor() {
2019-01-19 05:09:35 -05:00
assert.equal(red("Hello world"), "Hello world");
2018-12-18 23:30:44 -05:00
});
test(function doubleColor() {
2019-01-19 05:09:35 -05:00
assert.equal(bgBlue(red("Hello world")), "Hello world");
2019-01-15 16:16:52 -05:00
});
2019-01-19 05:09:35 -05:00
test(function replacesCloseCharacters() {
assert.equal(red("Hello"), "Hello");
2019-01-15 16:16:52 -05:00
});
2019-01-19 05:09:35 -05:00
test(function enablingColors() {
assert.equal(getEnabled(), true);
setEnabled(false);
assert.equal(bgBlue(red("Hello world")), "Hello world");
2018-12-18 23:30:44 -05:00
});