Skip to content
helpers for writing jest like expect tests in deno
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE Adding License Apr 20, 2019
README.md
expect.ts WIP - making failure messages much better Apr 21, 2019
expect_test.ts WIP - making failure messages much better Apr 21, 2019
matchers.ts WIP - making failure messages much better Apr 21, 2019
matchers_test.ts WIP - making failure messages much better Apr 21, 2019
mock.ts WIP - making failure messages much better Apr 21, 2019
mock_test.ts WIP - making failure messages much better Apr 21, 2019
mod.ts WIP - making failure messages much better Apr 21, 2019

README.md

expect

A deno implementation of expect in order to write tests in a more jest like style.

import { expect } from "./expect.ts";

expect(10).toEqual(10);
expect(Promise.resolves(20)).resolves.toEqual(20);
interface Expected {
  toBe(candidate: any, msg?: string): void;
  toEqual(candidate: any, msg?: string): void;
  toBeTruthy(msg?: string): void;
  toBeFalsy(msg?: string): void;
  toBeDefined(msg?: string): void;
  toBeInstanceOf(clazz: any, msg?: string): void;
  toBeUndefined(msg?: string): void;
  toBeNull(msg?: string): void;
  toBeNaN(msg?: string): void;
  toMatch(pattern: RegExp | string): void;
  toHaveProperty(propName: string, msg?: string): void;
  toHaveLength(length: number, msg?: string): void;
  toContain(item: any, msg?: string): void;
  toThrow(error?: RegExp | string, msg?: string): void;

  // comparison
  toBeGreaterThan(number: number, msg?: string): void;
  toBeGreaterThanOrEqual(number: number, msg?: string): void;
  toBeLessThan(number: number, msg?: string): void;
  toBeLessThanOrEqual(number: number, msg?: string): void;

  not: Expected;
  resolves: Expected;
  rejects: Expected;
}
You can’t perform that action at this time.