mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
docs(expect): minor doc tweaks (#5501)
* docs(expect): minor doc tweaks * tweaks
This commit is contained in:
parent
abdecb30b7
commit
88019ee78d
@ -4,8 +4,6 @@
|
|||||||
// deno-lint-ignore-file no-explicit-any ban-types
|
// deno-lint-ignore-file no-explicit-any ban-types
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @module
|
|
||||||
*
|
|
||||||
* This module contains a function to mock functions for testing and assertions.
|
* This module contains a function to mock functions for testing and assertions.
|
||||||
*
|
*
|
||||||
* ```ts
|
* ```ts
|
||||||
@ -19,6 +17,8 @@
|
|||||||
* expect(mockFn).toHaveBeenCalledTimes(1);
|
* expect(mockFn).toHaveBeenCalledTimes(1);
|
||||||
* });
|
* });
|
||||||
* ```
|
* ```
|
||||||
|
*
|
||||||
|
* @module
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { MOCK_SYMBOL, type MockCall } from "./_mock_util.ts";
|
import { MOCK_SYMBOL, type MockCall } from "./_mock_util.ts";
|
||||||
@ -26,7 +26,7 @@ import { MOCK_SYMBOL, type MockCall } from "./_mock_util.ts";
|
|||||||
/**
|
/**
|
||||||
* Creates a mock function that can be used for testing and assertions.
|
* Creates a mock function that can be used for testing and assertions.
|
||||||
*
|
*
|
||||||
* @param stubs - functions to be used as stubs for different calls.
|
* @param stubs Functions to be used as stubs for different calls.
|
||||||
* @returns A mock function that keeps track of calls and returns values based on the provided stubs.
|
* @returns A mock function that keeps track of calls and returns values based on the provided stubs.
|
||||||
*
|
*
|
||||||
* @example Usage
|
* @example Usage
|
||||||
|
@ -5,6 +5,16 @@
|
|||||||
/**
|
/**
|
||||||
* This module provides Jest compatible expect assertion functionality.
|
* This module provides Jest compatible expect assertion functionality.
|
||||||
*
|
*
|
||||||
|
* ```ts no-assert
|
||||||
|
* import { expect } from "@std/expect";
|
||||||
|
*
|
||||||
|
* const x = 6 * 7;
|
||||||
|
* expect(x).toEqual(42);
|
||||||
|
* expect(x).not.toEqual(0);
|
||||||
|
*
|
||||||
|
* await expect(Promise.resolve(x)).resolves.toEqual(42);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* Currently this module supports the following functions:
|
* Currently this module supports the following functions:
|
||||||
* - Common matchers:
|
* - Common matchers:
|
||||||
* - `toBe`
|
* - `toBe`
|
||||||
@ -69,21 +79,14 @@
|
|||||||
* - `expect.hasAssertions`
|
* - `expect.hasAssertions`
|
||||||
* - `expect.addSnapshotSerializer`
|
* - `expect.addSnapshotSerializer`
|
||||||
*
|
*
|
||||||
|
* The tracking issue to add support for unsupported parts of the API is
|
||||||
|
* {@link https://github.com/denoland/std/issues/3964}.
|
||||||
|
*
|
||||||
* This module is largely inspired by
|
* This module is largely inspired by
|
||||||
* {@link https://github.com/allain/expect | x/expect} module by Allain Lalonde.
|
* {@link https://github.com/allain/expect | x/expect} module by
|
||||||
*
|
* {@link https://github.com/allain | Allain Lalonde}.
|
||||||
* ```ts no-assert
|
|
||||||
* import { expect } from "@std/expect";
|
|
||||||
*
|
|
||||||
* const x = 6 * 7;
|
|
||||||
* expect(x).toEqual(42);
|
|
||||||
* expect(x).not.toEqual(0);
|
|
||||||
*
|
|
||||||
* await expect(Promise.resolve(x)).resolves.toEqual(42);
|
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* @module
|
* @module
|
||||||
*/
|
*/
|
||||||
export { expect } from "./expect.ts";
|
export * from "./expect.ts";
|
||||||
export type { AnyConstructor, Async, Expected } from "./expect.ts";
|
export * from "./fn.ts";
|
||||||
export { fn } from "./fn.ts";
|
|
||||||
|
Loading…
Reference in New Issue
Block a user