1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 02:29:06 -05:00
denoland-deno/colors/test.ts

26 lines
818 B
TypeScript
Raw Normal View History

2019-02-07 11:45:47 -05:00
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
2019-03-06 16:39:50 -05:00
import { test } from "../testing/mod.ts";
import { assertEquals } from "../testing/asserts.ts";
2019-01-19 05:09:35 -05:00
import { red, bgBlue, setEnabled, getEnabled } from "./mod.ts";
2019-03-18 11:08:01 -04:00
import "../examples/colors.ts";
2018-12-18 23:30:44 -05:00
test(function singleColor() {
assertEquals(red("Hello world"), "Hello world");
2018-12-18 23:30:44 -05:00
});
test(function doubleColor() {
assertEquals(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() {
assertEquals(red("Hello"), "Hello");
2019-01-15 16:16:52 -05:00
});
2019-01-19 05:09:35 -05:00
test(function enablingColors() {
assertEquals(getEnabled(), true);
2019-01-19 05:09:35 -05:00
setEnabled(false);
assertEquals(bgBlue(red("Hello world")), "Hello world");
setEnabled(true);
assertEquals(red("Hello world"), "Hello world");
2018-12-18 23:30:44 -05:00
});