// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { assertEquals } from "../testing/asserts.ts"; import * as c from "./colors.ts"; import "../examples/colors.ts"; Deno.test("singleColor", function (): void { assertEquals(c.red("foo bar"), "foo bar"); }); Deno.test("doubleColor", function (): void { assertEquals(c.bgBlue(c.red("foo bar")), "foo bar"); }); Deno.test("replacesCloseCharacters", function (): void { assertEquals(c.red("Hello"), "Hello"); }); Deno.test("enablingColors", function (): void { assertEquals(c.getColorEnabled(), true); c.setColorEnabled(false); assertEquals(c.bgBlue(c.red("foo bar")), "foo bar"); c.setColorEnabled(true); assertEquals(c.red("foo bar"), "foo bar"); }); Deno.test("testBold", function (): void { assertEquals(c.bold("foo bar"), "foo bar"); }); Deno.test("testDim", function (): void { assertEquals(c.dim("foo bar"), "foo bar"); }); Deno.test("testItalic", function (): void { assertEquals(c.italic("foo bar"), "foo bar"); }); Deno.test("testUnderline", function (): void { assertEquals(c.underline("foo bar"), "foo bar"); }); Deno.test("testInverse", function (): void { assertEquals(c.inverse("foo bar"), "foo bar"); }); Deno.test("testHidden", function (): void { assertEquals(c.hidden("foo bar"), "foo bar"); }); Deno.test("testStrikethrough", function (): void { assertEquals(c.strikethrough("foo bar"), "foo bar"); }); Deno.test("testBlack", function (): void { assertEquals(c.black("foo bar"), "foo bar"); }); Deno.test("testRed", function (): void { assertEquals(c.red("foo bar"), "foo bar"); }); Deno.test("testGreen", function (): void { assertEquals(c.green("foo bar"), "foo bar"); }); Deno.test("testYellow", function (): void { assertEquals(c.yellow("foo bar"), "foo bar"); }); Deno.test("testBlue", function (): void { assertEquals(c.blue("foo bar"), "foo bar"); }); Deno.test("testMagenta", function (): void { assertEquals(c.magenta("foo bar"), "foo bar"); }); Deno.test("testCyan", function (): void { assertEquals(c.cyan("foo bar"), "foo bar"); }); Deno.test("testWhite", function (): void { assertEquals(c.white("foo bar"), "foo bar"); }); Deno.test("testGray", function (): void { assertEquals(c.gray("foo bar"), "foo bar"); }); Deno.test("testBgBlack", function (): void { assertEquals(c.bgBlack("foo bar"), "foo bar"); }); Deno.test("testBgRed", function (): void { assertEquals(c.bgRed("foo bar"), "foo bar"); }); Deno.test("testBgGreen", function (): void { assertEquals(c.bgGreen("foo bar"), "foo bar"); }); Deno.test("testBgYellow", function (): void { assertEquals(c.bgYellow("foo bar"), "foo bar"); }); Deno.test("testBgBlue", function (): void { assertEquals(c.bgBlue("foo bar"), "foo bar"); }); Deno.test("testBgMagenta", function (): void { assertEquals(c.bgMagenta("foo bar"), "foo bar"); }); Deno.test("testBgCyan", function (): void { assertEquals(c.bgCyan("foo bar"), "foo bar"); }); Deno.test("testBgWhite", function (): void { assertEquals(c.bgWhite("foo bar"), "foo bar"); }); Deno.test("testClampUsingRgb8", function (): void { assertEquals(c.rgb8("foo bar", -10), "foo bar"); }); Deno.test("testTruncateUsingRgb8", function (): void { assertEquals(c.rgb8("foo bar", 42.5), "foo bar"); }); Deno.test("testRgb8", function (): void { assertEquals(c.rgb8("foo bar", 42), "foo bar"); }); Deno.test("test_bgRgb8", function (): void { assertEquals(c.bgRgb8("foo bar", 42), "foo bar"); }); Deno.test("test_rgb24", function (): void { assertEquals( c.rgb24("foo bar", { r: 41, g: 42, b: 43, }), "foo bar" ); }); Deno.test("test_rgb24number", function (): void { assertEquals(c.rgb24("foo bar", 0x070809), "foo bar"); }); Deno.test("test_bgRgb24", function (): void { assertEquals( c.bgRgb24("foo bar", { r: 41, g: 42, b: 43, }), "foo bar" ); }); Deno.test("test_bgRgb24number", function (): void { assertEquals(c.bgRgb24("foo bar", 0x070809), "foo bar"); });