mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
docs(assert): improve assertObjectMatch
docs (#5296)
This commit is contained in:
parent
ae956512eb
commit
ee4600667f
@ -3,7 +3,7 @@
|
||||
import { assertEquals } from "./equals.ts";
|
||||
|
||||
/**
|
||||
* Make an assertion that `actual` object is a subset of `expected` object,
|
||||
* Make an assertion that `expected` object is a subset of `actual` object,
|
||||
* deeply. If not, then throw.
|
||||
*
|
||||
* @example Usage
|
||||
@ -14,6 +14,14 @@ import { assertEquals } from "./equals.ts";
|
||||
* assertObjectMatch({ foo: "bar" }, { foo: "baz" }); // Throws
|
||||
* ```
|
||||
*
|
||||
* @example Usage with nested objects
|
||||
* ```ts no-eval
|
||||
* import { assertObjectMatch } from "@std/assert";
|
||||
*
|
||||
* assertObjectMatch({ foo: { bar: 3, baz: 4 } }, { foo: { bar: 3 } }); // Doesn't throw
|
||||
* assertObjectMatch({ foo: { bar: 3 } }, { foo: { bar: 3, baz: 4 } }); // Throws
|
||||
* ```
|
||||
*
|
||||
* @param actual The actual value to be matched.
|
||||
* @param expected The expected value to match.
|
||||
* @param msg The optional message to display if the assertion fails.
|
||||
|
Loading…
Reference in New Issue
Block a user