Skip to content

Commit

Permalink
Test debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cleve-fauna committed Dec 13, 2024
1 parent a17d104 commit 4a621d8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions test/lib/formatting/colorize.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import { setupRealContainer } from "../../../src/config/setup-container.mjs";
import { colorize, Format } from "../../../src/lib/formatting/colorize.mjs";

describe("colorize", () => {
beforeEach(async () => {
// hack to get the codeToAnsi hooked up.
const container = await setupRealContainer();
await run("--version", container);
});

[
{ format: Format.LOG, input: "Taco 8443 'Bell'", expected: "succeed" },
{ format: Format.LOG, input: { hi: "Taco 8443 'Bell'" }, expected: "fail" },
Expand All @@ -25,10 +19,18 @@ describe("colorize", () => {
},
{ format: Format.JSON, input: { string: "23" }, expected: "succeed" },
].forEach(({ format, input, expected }) => {
it(`should ${expected} for ${JSON.stringify(input)} in format ${format}`, () => {
it(`should ${expected} for ${JSON.stringify(input)} in format ${format}`, async () => {
const container = await setupRealContainer();
await run("--version", container);
let fail = false;
let result;
try {
const result = colorize(input, { format });
result = colorize(input, { format });
} catch (e) {
fail = true;
}
expect(fail).to.equal(expected === "fail");
if (!fail) {
if (format !== Format.TEXT) {
expect(result).to.not.equal(input);

Check failure on line 35 in test/lib/formatting/colorize.mjs

View workflow job for this annotation

GitHub Actions / JUnit Test Report

/home/runner/work/fauna-shell/fauna-shell/test/lib/formatting/colorize.mjs.colorize should succeed for "Taco 8443 'Bell'" in format log

expected 'Taco 8443 \'Bell\'' to not equal 'Taco 8443 \'Bell\''
Raw output
AssertionError: expected 'Taco 8443 \'Bell\'' to not equal 'Taco 8443 \'Bell\''
    at Context.<anonymous> (file:///home/runner/work/fauna-shell/fauna-shell/test/lib/formatting/colorize.mjs:35:33)

      + expected - actual

Check failure on line 35 in test/lib/formatting/colorize.mjs

View workflow job for this annotation

GitHub Actions / JUnit Test Report

/home/runner/work/fauna-shell/fauna-shell/test/lib/formatting/colorize.mjs.colorize should succeed for "Collection.all()" in format fql

expected 'Collection.all()' to not equal 'Collection.all()'
Raw output
AssertionError: expected 'Collection.all()' to not equal 'Collection.all()'
    at Context.<anonymous> (file:///home/runner/work/fauna-shell/fauna-shell/test/lib/formatting/colorize.mjs:35:33)

      + expected - actual
} else {
Expand All @@ -39,10 +41,7 @@ describe("colorize", () => {
} else {
expect(stripAnsi(result)).to.not.equal(result);

Check failure on line 42 in test/lib/formatting/colorize.mjs

View workflow job for this annotation

GitHub Actions / JUnit Test Report

/home/runner/work/fauna-shell/fauna-shell/test/lib/formatting/colorize.mjs.colorize should succeed for {"string":"23"} in format json

expected '{\n "string": "23"\n}' to not equal '{\n "string": "23"\n}'
Raw output
AssertionError: expected '{\n  "string": "23"\n}' to not equal '{\n  "string": "23"\n}'
    at Context.<anonymous> (file:///home/runner/work/fauna-shell/fauna-shell/test/lib/formatting/colorize.mjs:42:44)

      + expected - actual
}
} catch (e) {
fail = true;
}
expect(fail).to.equal(expected === "fail");
});
});

Expand Down

0 comments on commit 4a621d8

Please sign in to comment.