From 4c225480eded40ef45d888b473fbc02d862dd59b Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Wed, 15 Oct 2025 15:27:50 -0300 Subject: test: update mini CacheableObject constructor setups --- test/unit/data/cacheable-object.js | 12 ++++++++---- test/unit/data/composite/data/withPropertyFromObject.js | 8 ++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/unit/data/cacheable-object.js b/test/unit/data/cacheable-object.js index 4b927248..4be31788 100644 --- a/test/unit/data/cacheable-object.js +++ b/test/unit/data/cacheable-object.js @@ -2,10 +2,14 @@ import t from 'tap'; import CacheableObject from '#cacheable-object'; -function newCacheableObject(PD) { - return new (class extends CacheableObject { - static [CacheableObject.propertyDescriptors] = PD; - }); +function newCacheableObject(propertyDescriptors) { + const constructor = class extends CacheableObject { + static [CacheableObject.propertyDescriptors] = propertyDescriptors; + }; + + constructor.finalizeCacheableObjectPrototype(); + + return Reflect.construct(constructor, []); } t.test(`CacheableObject simple separate update & expose`, t => { diff --git a/test/unit/data/composite/data/withPropertyFromObject.js b/test/unit/data/composite/data/withPropertyFromObject.js index 912c924c..068932e2 100644 --- a/test/unit/data/composite/data/withPropertyFromObject.js +++ b/test/unit/data/composite/data/withPropertyFromObject.js @@ -61,7 +61,7 @@ t.test(`withPropertyFromObject: "internal" input`, t => { ], }); - const thing = new (class extends CacheableObject { + const constructor = class extends CacheableObject { static [CacheableObject.propertyDescriptors] = { foo: { flags: {update: true, expose: false}, @@ -78,7 +78,11 @@ t.test(`withPropertyFromObject: "internal" input`, t => { }, }, }; - }); + }; + + constructor.finalizeCacheableObjectPrototype(); + + const thing = Reflect.construct(constructor, []); thing.foo = 100; thing.bar = 200; -- cgit 1.3.0-6-gf8a5