-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: implement initial flag fetch (#294)
First attempt to implement an initial flag fetch followed by emitting events. I also added comments like this: ```tsx Dom api usage: xxx ``` There are three right now: fetch, btoa and EventTarget. I left comments in the code for react native how to deal with these. --------- Co-authored-by: LaunchDarklyReleaseBot <[email protected]> Co-authored-by: Ryan Lamb <[email protected]>
- Loading branch information
1 parent
a0dac0d
commit 8f34dfa
Showing
27 changed files
with
623 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface Encoding { | ||
btoa(data: string): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './Encoding'; | ||
export * from './Crypto'; | ||
export * from './Filesystem'; | ||
export * from './Info'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import type { ClientContext } from '@common'; | ||
|
||
import platform from './platform'; | ||
import basicPlatform from './platform'; | ||
|
||
const clientContext: ClientContext = { | ||
basicConfiguration: { | ||
sdkKey: 'testSdkKey', | ||
serviceEndpoints: { events: '', polling: '', streaming: 'https://mockstream.ld.com' }, | ||
}, | ||
platform, | ||
platform: basicPlatform, | ||
}; | ||
|
||
export default clientContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Response } from '@common'; | ||
|
||
import basicPlatform from './platform'; | ||
|
||
const createMockResponse = (remoteJson: any, statusCode: number) => { | ||
const response: Response = { | ||
headers: { | ||
get: jest.fn(), | ||
keys: jest.fn(), | ||
values: jest.fn(), | ||
entries: jest.fn(), | ||
has: jest.fn(), | ||
}, | ||
status: statusCode, | ||
text: jest.fn(), | ||
json: () => Promise.resolve(remoteJson), | ||
}; | ||
return Promise.resolve(response); | ||
}; | ||
|
||
/** | ||
* Mocks basicPlatform fetch. Returns the fetch jest.Mock object. | ||
* @param remoteJson | ||
* @param statusCode | ||
*/ | ||
const mockFetch = (remoteJson: any, statusCode: number = 200): jest.Mock => { | ||
const f = basicPlatform.requests.fetch as jest.Mock; | ||
f.mockResolvedValue(createMockResponse(remoteJson, statusCode)); | ||
return f; | ||
}; | ||
|
||
export default mockFetch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.