-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support non-ascii characters by upgrading common JS core #66
Conversation
@@ -72,4 +72,4 @@ lib/ | |||
.node-version | |||
.python-version | |||
|
|||
test/data | |||
src/__tests__/data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-locating test data with tests
rm -rf $(testDataDir) | ||
mkdir -p $(tempDir) | ||
git clone -b ${branchName} --depth 1 --single-branch ${githubRepoLink} ${gitDataDir} | ||
cp ${gitDataDir}rac-experiments-v3.json ${testDataDir} | ||
cp -r ${gitDataDir}assignment-v2 ${testDataDir} | ||
cp -r ${gitDataDir}ufc ${testDataDir} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the test data to UFC
@@ -51,7 +51,7 @@ | |||
"registry": "https://registry.npmjs.org/" | |||
}, | |||
"dependencies": { | |||
"@eppo/js-client-sdk-common": "4.3.0", | |||
"@eppo/js-client-sdk-common": "^4.7.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Core of the change
@@ -105,7 +113,9 @@ describe('EppoReactNativeClient integration test', () => { | |||
const mockConfigStore = td.object<EppoAsyncStorage>(); | |||
const mockLogger = td.object<IAssignmentLogger>(); | |||
td.when(mockConfigStore.get(flagKey)).thenReturn(null); | |||
const client_instance = new EppoReactNativeClient(mockConfigStore); | |||
const client_instance = new EppoReactNativeClient({ | |||
flagConfigurationStore: mockConfigStore, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Signature of the core repository constructor has changed from an argument list to an options object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mea culpa
@@ -227,3 +241,63 @@ describe('EppoReactNativeClient integration test', () => { | |||
expect(EppoReactNativeClient.initialized).toBe(false); | |||
}); | |||
}); | |||
|
|||
describe('UFC Obfuscated Test Cases', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shared test cases!
@@ -0,0 +1,101 @@ | |||
import * as fs from 'fs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is largely taken from the node repository. Future us should just export this common functionality in the common module as well.
@@ -59,13 +60,15 @@ export class EppoAsyncStorage | |||
private environment: Environment | null = null; | |||
private configFetchedAt: string | null = null; | |||
private configPublishedAt: string | null = null; | |||
private format: FormatEnum | null = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated common repository now has a format
property for IConfigurationStore
@aarsilv is this ready for review? still in draft mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -105,7 +113,9 @@ describe('EppoReactNativeClient integration test', () => { | |||
const mockConfigStore = td.object<EppoAsyncStorage>(); | |||
const mockLogger = td.object<IAssignmentLogger>(); | |||
td.when(mockConfigStore.get(flagKey)).thenReturn(null); | |||
const client_instance = new EppoReactNativeClient(mockConfigStore); | |||
const client_instance = new EppoReactNativeClient({ | |||
flagConfigurationStore: mockConfigStore, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mea culpa
public static instance: EppoReactNativeClient = new EppoReactNativeClient({ | ||
flagConfigurationStore: asyncStorage, | ||
isObfuscated: true, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
much better without all those undefined
s
@aarsilv I tested this out in RN 0.72 and it works. |
Eppo Internal:
🎟️ Ticket: FF-3769 - Update React Native SDK to use latest common JS module to support non-ascii characters
🗨️ Slack Thread: "...flag text encoding problem..."
👯 Related PR:
js-sdk-common #187
Motivation and Context
SDKs need to be able to handle special, non-ASCII characters.
Description
We update our common module, which switches from using
js-base64
'sbtoaPolyfill()
andatobPolyfill()
toencode
anddecode
respectively.The former is designed only to handle ASCII characters and bytes (docs), while the latter is designed for strings and can handle all characters.
I've also added the shared test suite to our tests
How has this been tested?
Updated shared test case

Tested with the latest version of React Native, 0.76

Tested with React Native version 0.72, which had issues in the past (see FF-2139 Fix base64 encoding/decoding for React Native 0.72.x js-sdk-common#75)
