Skip to content

Commit

Permalink
validate ready promise rejection
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoSanchez committed Nov 3, 2023
1 parent eb43b58 commit bbad0a4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/__tests__/nodeSuites/readiness.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
});
});

Expand Down

0 comments on commit bbad0a4

Please sign in to comment.