From 3d1825672b307c00eabd1730de9aa6e9fcd2b62c Mon Sep 17 00:00:00 2001 From: hexeberlin Date: Mon, 20 Jul 2026 18:50:23 +0200 Subject: [PATCH] fix: align restoreObject docs test with idempotent behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit restoreObject was made idempotent in #2737 — it no longer throws for objects with no restorable methods. Updates the docs page and its corresponding test to reflect this. --- docs/concepts/utils.md | 4 ++-- docs/tests/docs/utils-3.test.js | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/concepts/utils.md b/docs/concepts/utils.md index 40ab44560..6a5d5ecfd 100644 --- a/docs/concepts/utils.md +++ b/docs/concepts/utils.md @@ -23,8 +23,8 @@ Restores all methods of an object and returns the restored object. <<< ../.vitepress/tests/docs/utils-2.test.js -Throws an error if the object contains no restorable methods (spies, stubs, etc). +Does nothing if the object contains no restorable methods (spies, stubs, etc). <<< ../.vitepress/tests/docs/utils-3.test.js -Throws an error if the object contains no restorable methods (spies, stubs, etc). +Does nothing if the object contains no restorable methods (spies, stubs, etc). diff --git a/docs/tests/docs/utils-3.test.js b/docs/tests/docs/utils-3.test.js index 5fbb809da..c523df6b8 100644 --- a/docs/tests/docs/utils-3.test.js +++ b/docs/tests/docs/utils-3.test.js @@ -1,14 +1,12 @@ import t from "tap"; import sinon from "sinon"; -t.test("restoreObject throws when object has no restorable methods", (t) => { +t.test("restoreObject is a no-op when object has no restorable methods", (t) => { const emptyObj = {}; - // Verify it throws an error - t.throws( + t.doesNotThrow( () => sinon.restoreObject(emptyObj), - /no methods/i, - "should throw error about no methods to restore" + "should be a no-op when object has no restorable methods" ); t.end();