Skip to content

Commit d68c37a

Browse files
remove obselete validation (#1013)
* remove obselete validation * skipping test for now --------- Co-authored-by: Md Junaed Hossain <[email protected]>
1 parent 69e3f6f commit d68c37a

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

lib/utils/config_validator/index.tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
describe('lib/utils/config_validator', function() {
3131
describe('APIs', function() {
3232
describe('validate', function() {
33-
it('should complain if the provided error handler is invalid', function() {
33+
it.skip('should complain if the provided error handler is invalid', function() {
3434
const ex = assert.throws(function() {
3535
configValidator.validate({
3636
errorHandler: {},
@@ -39,7 +39,7 @@ describe('lib/utils/config_validator', function() {
3939
assert.equal(ex.baseMessage, INVALID_ERROR_HANDLER);
4040
});
4141

42-
it('should complain if the provided event dispatcher is invalid', function() {
42+
it.skip('should complain if the provided event dispatcher is invalid', function() {
4343
const ex = assert.throws(function() {
4444
configValidator.validate({
4545
eventDispatcher: {},
@@ -48,7 +48,7 @@ describe('lib/utils/config_validator', function() {
4848
assert.equal(ex.baseMessage, INVALID_EVENT_DISPATCHER);
4949
});
5050

51-
it('should complain if the provided logger is invalid', function() {
51+
it.skip('should complain if the provided logger is invalid', function() {
5252
const ex = assert.throws(function() {
5353
configValidator.validate({
5454
logger: {},

lib/utils/config_validator/index.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,7 @@ const SUPPORTED_VERSIONS = [DATAFILE_VERSIONS.V2, DATAFILE_VERSIONS.V3, DATAFILE
4343
export const validate = function(config: unknown): boolean {
4444
if (typeof config === 'object' && config !== null) {
4545
const configObj = config as ObjectWithUnknownProperties;
46-
const errorHandler = configObj['errorHandler'];
47-
const eventDispatcher = configObj['eventDispatcher'];
48-
const logger = configObj['logger'];
49-
if (errorHandler && typeof (errorHandler as ObjectWithUnknownProperties)['handleError'] !== 'function') {
50-
throw new OptimizelyError(INVALID_ERROR_HANDLER);
51-
}
52-
if (eventDispatcher && typeof (eventDispatcher as ObjectWithUnknownProperties)['dispatchEvent'] !== 'function') {
53-
throw new OptimizelyError(INVALID_EVENT_DISPATCHER);
54-
}
55-
if (logger && typeof (logger as ObjectWithUnknownProperties)['info'] !== 'function') {
56-
throw new OptimizelyError(INVALID_LOGGER);
57-
}
46+
// TODO: add validation
5847
return true;
5948
}
6049
throw new OptimizelyError(INVALID_CONFIG);

0 commit comments

Comments
 (0)