Skip to content

Commit

Permalink
fix: removed info Optimizely logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JodyBaileyy committed Jul 13, 2023
1 parent 103a676 commit e959305
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
14 changes: 10 additions & 4 deletions src/widgets/ProductRecommendations/optimizely.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { createInstance } from '@optimizely/react-sdk';
import { createInstance, setLogLevel } from '@optimizely/react-sdk';

const OPTIMIZELY_SDK_KEY = process.env.OPTIMIZELY_FULL_STACK_SDK_KEY;

const optimizelyClient = createInstance({
sdkKey: OPTIMIZELY_SDK_KEY,
});
const configureClient = () => {
setLogLevel('error');

return createInstance({
sdkKey: OPTIMIZELY_SDK_KEY,
});
};

const optimizelyClient = configureClient();

export default optimizelyClient;
6 changes: 4 additions & 2 deletions src/widgets/ProductRecommendations/optimizely.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { createInstance } from '@optimizely/react-sdk';
import { createInstance, setLogLevel } from '@optimizely/react-sdk';
import optimizelyClient from './optimizely';

jest.mock('@optimizely/react-sdk', () => ({
createInstance: jest.fn(() => 'mockedClient'),
setLogLevel: jest.fn(),
}));

describe('optimizelyClient', () => {
it('should create an Optimizely client instance with the correct SDK key', () => {
it('should configure an Optimizely client instance with the correct SDK key', () => {
expect(optimizelyClient).toBeDefined();
expect(setLogLevel).toHaveBeenCalledWith('error');
expect(createInstance).toHaveBeenCalledWith({ sdkKey: 'SDK Key' });
});
});

0 comments on commit e959305

Please sign in to comment.