From b8d9765a83ddccedfa0c0998b16dbd2a8078db86 Mon Sep 17 00:00:00 2001
From: Md Junaed Hossain <169046794+junaed-optimizely@users.noreply.github.com>
Date: Thu, 7 Nov 2024 19:50:14 +0600
Subject: [PATCH 1/5] [FSSDK-10880] override initial user bug adjustment
---
src/Provider.spec.tsx | 4 ++++
src/Provider.tsx | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/src/Provider.spec.tsx b/src/Provider.spec.tsx
index 84cda0a..f2891a6 100644
--- a/src/Provider.spec.tsx
+++ b/src/Provider.spec.tsx
@@ -83,6 +83,8 @@ describe('OptimizelyProvider', () => {
});
it('should render successfully without user or userId provided', () => {
+ // @ts-ignore
+ mockReactClient.user = undefined;
render();
expect(mockReactClient.setUser).toHaveBeenCalledWith(DefaultUser);
@@ -95,6 +97,8 @@ describe('OptimizelyProvider', () => {
});
it('should succeed just userAttributes provided', () => {
+ // @ts-ignore
+ mockReactClient.user = undefined;
render();
expect(mockReactClient.setUser).toHaveBeenCalledWith({
diff --git a/src/Provider.tsx b/src/Provider.tsx
index b0da5ca..5a126b5 100644
--- a/src/Provider.tsx
+++ b/src/Provider.tsx
@@ -73,6 +73,11 @@ export class OptimizelyProvider extends React.Component
Date: Thu, 7 Nov 2024 20:11:19 +0600
Subject: [PATCH 2/5] [FSSDK-10880] integration workflow check
---
.github/workflows/integration_test.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml
index 8fd2424..2f462d1 100644
--- a/.github/workflows/integration_test.yml
+++ b/.github/workflows/integration_test.yml
@@ -14,7 +14,7 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v3
with:
- token: ${{ secrets.CI_USER_TOKEN }}
+ token: ${{ secrets.GITHUB_TOKEN }}`
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
From 77b455522cbd7bf20b5b2733a46a5c04000a97b8 Mon Sep 17 00:00:00 2001
From: Md Junaed Hossain <169046794+junaed-optimizely@users.noreply.github.com>
Date: Thu, 7 Nov 2024 20:17:20 +0600
Subject: [PATCH 3/5] [FSSDK-10880] logic update
---
.github/workflows/integration_test.yml | 2 +-
src/Provider.tsx | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml
index 2f462d1..1f2b1b4 100644
--- a/.github/workflows/integration_test.yml
+++ b/.github/workflows/integration_test.yml
@@ -14,7 +14,7 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v3
with:
- token: ${{ secrets.GITHUB_TOKEN }}`
+ token: ${{ secrets.CI_USER_TOKEN || secrets.GITHUB_TOKEN }}`
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
diff --git a/src/Provider.tsx b/src/Provider.tsx
index 5a126b5..5d4a134 100644
--- a/src/Provider.tsx
+++ b/src/Provider.tsx
@@ -74,9 +74,10 @@ export class OptimizelyProvider extends React.Component
Date: Thu, 7 Nov 2024 20:18:40 +0600
Subject: [PATCH 4/5] [FSSDK-10880] syntax fix
---
.github/workflows/integration_test.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml
index 1f2b1b4..686595e 100644
--- a/.github/workflows/integration_test.yml
+++ b/.github/workflows/integration_test.yml
@@ -14,7 +14,7 @@ jobs:
- name: Checkout branch
uses: actions/checkout@v3
with:
- token: ${{ secrets.CI_USER_TOKEN || secrets.GITHUB_TOKEN }}`
+ token: ${{ secrets.CI_USER_TOKEN || secrets.GITHUB_TOKEN }}
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
From 382692e3e9747a7443719de1f39f9cfbc3aec7c1 Mon Sep 17 00:00:00 2001
From: Md Junaed Hossain <169046794+junaed-optimizely@users.noreply.github.com>
Date: Thu, 7 Nov 2024 20:25:49 +0600
Subject: [PATCH 5/5] [FSSDK-10880] new tests addition
---
src/Provider.spec.tsx | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/Provider.spec.tsx b/src/Provider.spec.tsx
index f2891a6..4d89012 100644
--- a/src/Provider.spec.tsx
+++ b/src/Provider.spec.tsx
@@ -107,6 +107,21 @@ describe('OptimizelyProvider', () => {
});
});
+ it('should succeed with the initial user available in client', () => {
+ render();
+
+ expect(mockReactClient.setUser).toHaveBeenCalledWith(user1);
+ });
+
+ it('should succeed with the initial user id and newly passed attributes', () => {
+ render();
+
+ expect(mockReactClient.setUser).toHaveBeenCalledWith({
+ id: user1.id,
+ attributes: { attr1: 'value2' },
+ });
+ });
+
it('should not update when isServerSide is true', () => {
// Initial render
const { rerender } = render();