From 422f9da02d2e8c0c227887265bce25cecaecf403 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 19 Jul 2022 20:23:54 -0400 Subject: [PATCH] test(schema): add coverage for calling `plugin()` with options Fix #12077 --- test/schema.test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/schema.test.js b/test/schema.test.js index 7bc6299e23..8cfac9618a 100644 --- a/test/schema.test.js +++ b/test/schema.test.js @@ -924,6 +924,19 @@ describe('schema', function() { assert.equal(called, true); }); + + it('options param (gh-12077)', function() { + const Tobi = new Schema(); + let called = false; + + Tobi.plugin(function(schema, opts) { + assert.equal(schema, Tobi); + assert.deepStrictEqual(opts, { answer: 42 }); + called = true; + }, { answer: 42 }); + + assert.equal(called, true); + }); }); describe('options', function() {