From ee4600667f7f97766d0e0d8f4b47976187552cd8 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 4 Jul 2024 18:59:18 +0900 Subject: [PATCH] docs(assert): improve `assertObjectMatch` docs (#5296) --- assert/object_match.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assert/object_match.ts b/assert/object_match.ts index 08c1b9449..2a5e07df6 100644 --- a/assert/object_match.ts +++ b/assert/object_match.ts @@ -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.