docs(expect): minor doc tweaks (#5501)

* docs(expect): minor doc tweaks

* tweaks
This commit is contained in:
Asher Gomez 2024-07-22 13:17:47 +10:00 committed by GitHub
parent abdecb30b7
commit 88019ee78d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 17 deletions

View File

@ -4,8 +4,6 @@
// deno-lint-ignore-file no-explicit-any ban-types
/**
* @module
*
* This module contains a function to mock functions for testing and assertions.
*
* ```ts
@ -19,6 +17,8 @@
* expect(mockFn).toHaveBeenCalledTimes(1);
* });
* ```
*
* @module
*/
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.
*
* @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.
*
* @example Usage

View File

@ -5,6 +5,16 @@
/**
* 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:
* - Common matchers:
* - `toBe`
@ -69,21 +79,14 @@
* - `expect.hasAssertions`
* - `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
* {@link https://github.com/allain/expect | x/expect} module by 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);
* ```
* {@link https://github.com/allain/expect | x/expect} module by
* {@link https://github.com/allain | Allain Lalonde}.
*
* @module
*/
export { expect } from "./expect.ts";
export type { AnyConstructor, Async, Expected } from "./expect.ts";
export { fn } from "./fn.ts";
export * from "./expect.ts";
export * from "./fn.ts";