🤷♀️ Expectations
What to expect(), when you're expecting!
There are a set of comparison functions defined in the
types/as-pect.d.ts
types definition. These comparison functions allow you to inspect object and memory state.class Expectation<T> {
constructor(public actual: T) {}
not: Expectation<T>;
// prototype methods follow
}
Expectations can be created like this:
// create an Expectation with typeof SomeValue`
expect(SomeValue);
Expectations can be negated like this:
// negate an assertion
expect(someValue).not.toBe(anotherValue);
// This assertion is effectively:
// I don't expect this value to be exactly this value
Calling the
expect<T>(value: T)
function outside of the following functions will result in unexpected behavior:beforeEach()
afterEach()
beforeAll()
afterAll()
test()
it()
throws()
itThrows()
If this happens, the entire test suite will fail before it runs in the CLI, and the error description will be reported to the console.
Last modified 3yr ago