Skip to content

Commit

Permalink
tests: update NO_COLOR tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Im-Beast committed May 17, 2022
1 parent 2efe266 commit 47116f8
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ import {
assertThrows,
} from "https://deno.land/[email protected]/testing/asserts.ts";

// Keep in mind that NO_COLOR won't actually effect of this test.
let log = `NO_COLOR: ${getNoColor()}\n`;
// Keep in mind that NO_COLOR will break this test.

if (getNoColor()) {
Deno.exit(1);
}

let log = ``;

if (isDeno()) {
addEventListener("unload", () => {
Expand Down Expand Up @@ -52,6 +57,7 @@ Deno.test("Config", async (t) => {
assertEquals(
crayon.colorSupport,
{
noColor: !hasColor,
trueColor: hasColor,
highColor: hasColor,
fourBitColor: hasColor,
Expand All @@ -62,6 +68,7 @@ Deno.test("Config", async (t) => {

await t.step("Property and object assignment", () => {
const old = crayon.colorSupport;

crayon.colorSupport = {
fourBitColor: false,
highColor: false,
Expand All @@ -73,6 +80,7 @@ Deno.test("Config", async (t) => {
assertEquals(old, crayon.colorSupport);
assertEquals(colorSupport, crayon.colorSupport);
assertEquals(crayon.colorSupport, {
noColor: old.noColor,
trueColor: false,
highColor: false,
fourBitColor: false,
Expand All @@ -82,6 +90,7 @@ Deno.test("Config", async (t) => {
crayon.colorSupport.fourBitColor = true;
assertEquals(crayon.colorSupport.fourBitColor, true);
assertEquals(crayon.colorSupport, {
noColor: old.noColor,
trueColor: false,
highColor: false,
fourBitColor: true,
Expand Down

0 comments on commit 47116f8

Please sign in to comment.