Skip to content

Commit 93e4284

Browse files
committed
1. changed client engine values
2. Added tests to make sure client engine values always end with -sdk
1 parent b38b9a5 commit 93e4284

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

packages/optimizely-sdk/lib/index.react_native.tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ describe('javascript-sdk/react-native', function() {
104104
});
105105
// Invalid datafile causes onReady Promise rejection - catch this error
106106
optlyInstance.onReady().catch(function() {});
107-
assert.equal('react-native-js', optlyInstance.clientEngine);
107+
assert.equal('react-native-js-sdk', optlyInstance.clientEngine);
108108
assert.equal(packageJSON.version, optlyInstance.clientVersion);
109109
});
110110

111-
it('should allow passing of "react-sdk" as the clientEngine and convert it to "react-native"', function() {
111+
it('should allow passing of "react-sdk" as the clientEngine and convert it to "react-native-sdk"', function() {
112112
var optlyInstance = optimizelyFactory.createInstance({
113113
clientEngine: 'react-sdk',
114114
datafile: {},
@@ -118,7 +118,7 @@ describe('javascript-sdk/react-native', function() {
118118
});
119119
// Invalid datafile causes onReady Promise rejection - catch this error
120120
optlyInstance.onReady().catch(function() {});
121-
assert.equal('react-native', optlyInstance.clientEngine);
121+
assert.equal('react-native-sdk', optlyInstance.clientEngine);
122122
});
123123

124124
it('should activate with provided event dispatcher', function() {

packages/optimizely-sdk/lib/utils/enums/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ exports.CONTROL_ATTRIBUTES = {
174174
exports.JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk';
175175
exports.NODE_CLIENT_ENGINE = 'node-sdk';
176176
exports.REACT_CLIENT_ENGINE = 'react-sdk';
177-
exports.REACT_NATIVE_CLIENT_ENGINE = 'react-native';
178-
exports.REACT_NATIVE_JS_CLIENT_ENGINE = 'react-native-js';
177+
exports.REACT_NATIVE_CLIENT_ENGINE = 'react-native-sdk';
178+
exports.REACT_NATIVE_JS_CLIENT_ENGINE = 'react-native-js-sdk';
179179
exports.NODE_CLIENT_VERSION = '3.6.0-alpha.1';
180180

181181
exports.VALID_CLIENT_ENGINES = [
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/****************************************************************************
2+
* Copyright 2020, Optimizely, Inc. and contributors *
3+
* *
4+
* Licensed under the Apache License, Version 2.0 (the "License"); *
5+
* you may not use this file except in compliance with the License. *
6+
* You may obtain a copy of the License at *
7+
* *
8+
* http://www.apache.org/licenses/LICENSE-2.0 *
9+
* *
10+
* Unless required by applicable law or agreed to in writing, software *
11+
* distributed under the License is distributed on an "AS IS" BASIS, *
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13+
* See the License for the specific language governing permissions and *
14+
* limitations under the License. *
15+
***************************************************************************/
16+
17+
var chai = require('chai')
18+
var enums = require('./')
19+
var assert = chai.assert;
20+
21+
describe('lib/utils/enums', function() {
22+
describe('valid client engines', function() {
23+
it('all valid client engines should end with "-sdk"', function() {
24+
enums.VALID_CLIENT_ENGINES.forEach(function(clientEngine) {
25+
assert.isTrue(clientEngine.endsWith('-sdk'))
26+
});
27+
});
28+
});
29+
});

0 commit comments

Comments
 (0)