Skip to main content
Module

x/unitest/mod.ts>toEqualIgnoringWhitespace

🃏 Deno-first universal unit testing framework
Latest
function toEqualIgnoringWhitespace
Re-export
import { toEqualIgnoringWhitespace } from "https://deno.land/x/unitest@v1.0.0-beta.82/mod.ts";

Use .toEqualIgnoringWhitespace when checking if a string is equal to another string ignoring white-space.

import {
  defineExpect,
  not,
  test,
  toEqualIgnoringWhitespace,
} from "https://deno.land/x/unitest@$VERSION/mod.ts";

const expect = defineExpect({
  matcherMap: {
    toEqualIgnoringWhitespace,
  },
  modifierMap: {
    not,
  },
});

test("passes if strings are equal ignoring white-space", () => {
  expect("SELECT * FROM TABLE WHERE CONDITION").toEqualIgnoringWhitespace(`
        SELECT * FROM TABLE
        WHERE CONDITION
    `);
  expect(".class { cssRule: value }").not.toEqualIgnoringWhitespace(`
        #id {
            cssRule: value
        }
    `);
});

Parameters

actual: string
expected: string