Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/unitest/matcher/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/matcher/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