From bbad0a44ebccde3510a4837925d0d17b288dc80d Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Fri, 3 Nov 2023 13:24:58 -0300 Subject: [PATCH] validate ready promise rejection --- src/__tests__/nodeSuites/readiness.spec.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/__tests__/nodeSuites/readiness.spec.js b/src/__tests__/nodeSuites/readiness.spec.js index 622026102..199f29082 100644 --- a/src/__tests__/nodeSuites/readiness.spec.js +++ b/src/__tests__/nodeSuites/readiness.spec.js @@ -39,12 +39,19 @@ export default function (fetchMock, assert) { t.fail('### IS READY - NOT TIMED OUT when it should.'); t.end(); }); - client.once(client.Event.SDK_READY_TIMED_OUT, () => { + client.once(client.Event.SDK_READY_TIMED_OUT, async () => { t.pass('### SDK TIMED OUT - SegmentChanges requests with client-side SDK key should fail with 403. Timed out.'); t.false(client.track('some_key', 'some_tt', 'some_event_type'), 'since client is flagged as destroyed, client.track returns false'); - - client.destroy().then(() => { t.end(); }); + t.equal(client.getTreatment('hierarchical_splits_test'), 'control', 'since client is flagged as destroyed, client.getTreatment returns control'); + + // ready promise should reject + try { + await client.ready(); + } catch (e) { + await client.destroy(); + t.end(); + } }); });