Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #91 from launchdarkly/eb/wait-for-init-value
Browse files Browse the repository at this point in the history
fix waitForInitialization to always resolve with a value
  • Loading branch information
eli-darkly authored Aug 1, 2018
2 parents bcb4f0e + 018c6f2 commit 44f2d4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ var newClient = function(sdkKey, config) {
}

return new Promise(function(resolve, reject) {
client.once('ready', resolve);
client.once('ready', function() { resolve(client) });
client.once('failed', reject);
});
};
Expand Down
2 changes: 2 additions & 0 deletions test/LDClient-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ describe('LDClient', function() {
client.waitForInitialization().then(callback)
.then(() => {
expect(callback).toHaveBeenCalled();
expect(callback.mock.calls[0][0]).toBe(client);
done();
}).catch(done.error)
});
Expand All @@ -338,6 +339,7 @@ describe('LDClient', function() {
client.waitForInitialization().then(callback)
.then(() => {
expect(callback).toHaveBeenCalled();
expect(callback.mock.calls[0][0]).toBe(client);
done();
}).catch(done.error)
}).catch(done.error)
Expand Down

0 comments on commit 44f2d4a

Please sign in to comment.