Skip to content

Commit 0abb7b9

Browse files
Fix promise tests
1 parent 947aca4 commit 0abb7b9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/__tests__/browserSuites/ready-from-cache.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,8 @@ export default function (fetchMock, assert) {
371371
t.true(Date.now() - startTime >= 400, 'It should emit SDK_READY too but after syncing with the cloud.');
372372
t.equal(client.getTreatment('always_on'), 'on', 'It should evaluate treatments with updated data after syncing with the cloud.');
373373
});
374-
client.whenReadyFromCache().then((isReady) => {
375-
t.false(isReady, 'It should be ready from cache before ready (syncing with the cloud).');
374+
client.whenReadyFromCache().then((metadata) => {
375+
t.false(metadata.initialCacheLoad, 'It should be ready from cache before ready (syncing with the cloud).');
376376
t.true(Date.now() - startTime < 50, 'It should resolve ready from cache promise almost immediately.');
377377
});
378378
client.whenReady().then(() => {
@@ -383,8 +383,8 @@ export default function (fetchMock, assert) {
383383
t.true(Date.now() - startTime >= 700, 'It should emit SDK_READY too but after syncing with the cloud.');
384384
t.equal(client2.getTreatment('always_on'), 'on', 'It should evaluate treatments with updated data after syncing with the cloud.');
385385
});
386-
client2.whenReadyFromCache().then((isReady) => {
387-
t.false(isReady, 'It should be ready from cache before ready (syncing with the cloud).');
386+
client2.whenReadyFromCache().then((metadata) => {
387+
t.false(metadata.initialCacheLoad, 'It should be ready from cache before ready (syncing with the cloud).');
388388
});
389389
client2.whenReady().then(() => {
390390
t.true(Date.now() - startTime >= 700, 'It should resolve ready promise after syncing with the cloud.');
@@ -488,8 +488,8 @@ export default function (fetchMock, assert) {
488488
t.true(nearlyEqual(Date.now() - startTime, CLIENT_READY_MS), 'It should emit SDK_READY after syncing with the cloud.');
489489
t.equal(client.getTreatment('always_on'), 'on', 'It should evaluate treatments with updated data after syncing with the cloud.');
490490
});
491-
client.whenReadyFromCache().then((isReady) => {
492-
t.true(isReady, 'It should be ready from cache and ready.');
491+
client.whenReadyFromCache().then((metadata) => {
492+
t.true(metadata.initialCacheLoad, 'It should be ready from cache and ready.');
493493
t.true(nearlyEqual(Date.now() - startTime, CLIENT_READY_MS), 'It should resolve ready from cache promise after syncing with the cloud.');
494494
});
495495
client.whenReady().then(() => {

src/__tests__/browserSuites/ready-promise.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ export default function readyPromiseAssertions(fetchMock, assert) {
521521

522522
consoleSpy.log.resetHistory();
523523
setTimeout(() => {
524-
client.whenReadyFromCache().then((isReady) => t.true(isReady, 'SDK IS READY (& READY FROM CACHE) - Should resolve')).catch(() => t.fail('SDK TIMED OUT - Should not reject'));
524+
client.whenReadyFromCache().then((metadata) => t.true(metadata.initialCacheLoad, 'SDK IS READY (& READY FROM CACHE) - Should resolve')).catch(() => t.fail('SDK TIMED OUT - Should not reject'));
525525

526526
assertGetTreatmentWhenReady(t, client);
527527

src/__tests__/nodeSuites/ready-promise.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ export default function readyPromiseAssertions(key, fetchMock, assert) {
494494

495495
consoleSpy.log.resetHistory();
496496
setTimeout(() => {
497-
client.whenReadyFromCache().then((isReady) => t.true(isReady, 'SDK IS READY (& READY FROM CACHE) - Should resolve')).catch(() => t.fail('SDK TIMED OUT - Should not reject'));
497+
client.whenReadyFromCache().then((metadata) => t.true(metadata.initialCacheLoad, 'SDK IS READY (& READY FROM CACHE) - Should resolve')).catch(() => t.fail('SDK TIMED OUT - Should not reject'));
498498

499499
assertGetTreatmentWhenReady(t, client, key);
500500

0 commit comments

Comments
 (0)