Commit b12a9a57 authored by revathi's avatar revathi Committed by kochhar
Browse files

Issue #SB-3715 fix: review fixes

parent 707ef4c3
master dependabot/npm_and_yarn/src/async-2.6.4 dependabot/npm_and_yarn/src/decode-uri-component-0.2.2 dependabot/npm_and_yarn/src/flat-and-mocha-5.0.2 dependabot/npm_and_yarn/src/handlebars-4.7.7 dependabot/npm_and_yarn/src/jsonwebtoken-9.0.0 dependabot/npm_and_yarn/src/lodash-4.17.21 dependabot/npm_and_yarn/src/minimist-and-project-sunbird/telemetry-sdk-and-handlebars-and-mkdirp-1.2.8 release-3.6.0 release-4.3.0 release-4.8.0 release-5.2.0 release-5.3.0 release-5.6.0 release-6.0.0 v1.13.3 v1.13 v1.12 v1.11.1 v1.11 v1.10.1 v1.10 v1.9 tmp-testPR tmp-sunbird-bootcamp tmp-rjshrjndrn-patch-1 tmp-revert-118-testPR tmp-revert-110-logs tmp-revert-99-revert-98-revert-97-revert-96-rjshrjndrn-patch-1 tmp-revert-98-revert-97-revert-96-rjshrjndrn-patch-1 tmp-revert-97-revert-96-rjshrjndrn-patch-1 tmp-revert-96-rjshrjndrn-patch-1 tmp-release-sonarcloud tmp-release-2.6.0 tmp-release-2.3.0 tmp-release-2.1.1 tmp-release-2.1.0 tmp-release-2.1.0_pluginSearch tmp-release-2.0.0 tmp-release-1.15 tmp-release-1.14.3 tmp-release-1.14 tmp-release-1.14-sp3 tmp-refactored-dev-deploy tmp-master tmp-loadtest tmp-load-testing tmp-jenkins-test tmp-jenkins-pipeline tmp-final-variable-refac tmp-dial-assemble-api tmp-content-update-read tmp-circleci release-5.6.0_RC1 release-5.2.0_RC1 release-4.8.5_RC1 release-4.8.0_RC2 release-4.8.0_RC1 release-4.3.0_RC1 release-3.8.0_RC3 release-3.8.0_RC2 release-3.8.0_RC1 release-3.7.0_RC2 release-3.7.0_RC1 release-3.6.0_RC1 release-3.2.0_RC2 release-3.2.0_RC1 release-3.1.0 release-3.1.0_RC2 release-3.1.0_RC1 release-3.0.1_RC1 release-3.0.0 release-3.0.0_RC1 release-2.10.0 release-2.10.0_RC2 release-2.10.0_RC1 release-2.9.0_RC3 release-2.9.0_RC2 release-2.9.0_RC1 release-2.8.0 release-2.8.0_RC4 release-2.8.0_RC3 release-2.8.0_RC2 release-2.8.0_RC1 release-2.7.0 release-2.7.0_RC2 release-2.7.0_RC1 release-2.6.0 release-2.6.0_RC4 release-2.6.0_RC3 release-2.6.0_RC2 release-2.6.0_RC1 release-2.3.0 release-2.3.0_RC2 release-2.3.0_RC1 release-2.1.1_RC1 release-2.1.0_RC2 release-2.1.0_RC1 release-2.0.0 release-2.0.0_RC5 release-2.0.0_RC4 release-2.0.0_RC3 release-2.0.0_RC2 release-2.0.0_RC1 release-1.15.0 release-1.15_RC7 release-1.15_RC6 release-1.15_RC5 release-1.15_RC4 release-1.15_RC3 release-1.15_RC2 release-1.15_RC1 release-1.14.0
No related merge requests found
Showing with 37 additions and 29 deletions
+37 -29
...@@ -156,16 +156,21 @@ const telemetryConfig = { ...@@ -156,16 +156,21 @@ const telemetryConfig = {
telemetry.init(telemetryConfig) telemetry.init(telemetryConfig)
// function to generate the search string // function to generate the search filter and return JSON Object
function getMetaFilterConfig () { function getMetaFilterConfig () {
return setFilterJSONFromEnv() // Check if the Filter Config service data is defined, if yes, create Object with it
if (filterConfigService !== undefined) {
return getFilterJSONfromConfigService()
} else {
// Call getFilterJSONFromEnv to generate a JSON Object
return getFilterJSONFromEnv()
}
} }
function setFilterJSONFromEnv () {
function getFilterJSONFromEnv () {
// Generate JSON and return // Generate JSON and return
return setFilterJSON()
} }
function setFilterJSON () { function getFilterJSONfromConfigService () {
// Generate JSON from Config Service and return
} }
...@@ -3,15 +3,14 @@ var filterService = require('../service/filterService') ...@@ -3,15 +3,14 @@ var filterService = require('../service/filterService')
function addMetaFilters (req, res, next) { function addMetaFilters (req, res, next) {
// If the request body has filter by metaFilter data, continue with the same filter, do not alter the values // If the request body has filter by metaFilter data, continue with the same filter, do not alter the values
// else call the getMetaSearchData() function to generate the JSON Object for the meta filters
// else call the getMetaSearchString() function to generate the search string for the meta filters filterService.getMetaSearchData(function () {
filterService.getMetaSearchString(function () {
// Generate JSON and return // Generate JSON and return
return setFilterJSON() return setFilterJSON()
}) })
} }
function setFilterJSON () { function setFilterJSON () {
// Set the new filter Object for filter request body
} }
module.exports.addMetaFilters = addMetaFilters module.exports.addMetaFilters = addMetaFilters
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
*/ */
var configUtil = require('sb-config-util') var configUtil = require('sb-config-util')
function getMetaSearchString (callback) { function getMetaSearchData (callback) {
var searchString = configUtil.getConfig('META_FILTER_QUERY_STRING') var searchData = configUtil.getConfig('META_FILTER_REQUEST_JSON')
callback(null, searchString) callback(null, searchData)
} }
module.exports.getMetaSearchString = getMetaSearchString module.exports.getMetaSearchData = getMetaSearchData
...@@ -53,7 +53,9 @@ describe('Check health api', function (done) { ...@@ -53,7 +53,9 @@ describe('Check health api', function (done) {
it('test for blackList metafilter configured', function () {}) it('test for blackList metafilter configured', function () {})
it('test for whitelist metafilter and blackList not configured', function () {}) it('test for whitelist metafilter and blackList not configured', function () {})
it('test for whitelist metafilter and blackList is configured', function () {}) it('test for whitelist metafilter and blackList is configured', function () {})
it('check if filter JSON is generated', function () { }) it('Check if filterConfig service data is available', function () {})
it('If FilterConfig is null/undefined, generate filter Object from environment variables', function () { })
it('Check if filter JSON is generated', function () { })
}) })
// below method used to close server once all the specs are executed // below method used to close server once all the specs are executed
......
...@@ -65,7 +65,3 @@ describe('Check for all route to be calling the AddChannelFilter', function () { ...@@ -65,7 +65,3 @@ describe('Check for all route to be calling the AddChannelFilter', function () {
}) })
}) })
}) })
describe('Check for all route to be calling the AddMetaFilter', function () {
it('check for filter in config with route', function () {})
it('check for filter in config with value + route', function () {})
})
describe('Check for all required route to call the AddMetaFilter', function () {
it('check for filter in config with route', function () {})
it('check for filter in config with value + route', function () {})
})
describe('Initialization of meta filters', function () {
it('check for the request and then do next', function () {})
it('check for no request and get config', function () {})
it('check for the filter object property exists in the request body', function () {})
it('if filter object property is equal to response body property then do not append property to the filter', function () {})
it('if the filter object property is not equal to response body property then append property to the filter', function () {})
it('check for getMetaSearchData method creates proper whitelisted search data', function () {})
it('check for getMetaSearchData method creates proper blacklisted search data', function () {})
})
...@@ -51,10 +51,3 @@ describe('filter of channels', function () { ...@@ -51,10 +51,3 @@ describe('filter of channels', function () {
}) })
}) })
}) })
describe('Initialization of meta filters', function () {
it('check for the request and then do next', function () {})
it('check for no request and get config', function () {})
it('check for getMetaSearchString method creates proper whitelisted search string', function () {})
it('check for getMetaSearchString method creates proper blacklisted search string', function () {})
})
...@@ -21,8 +21,8 @@ describe('filter service', function () { ...@@ -21,8 +21,8 @@ describe('filter service', function () {
}) })
}) })
describe('content meta filter service', function () { describe('content meta filter service from config', function () {
it('check for getMetaSearchString method', function () {}) it('check for getMetaSearchData method', function () {})
it('check for whitelisted metafilter set in config', function () {}) it('check for whitelisted metafilter set in config', function () {})
it('check for blacklisted metafilter set in config', function () {}) it('check for blacklisted metafilter set in config', function () {})
}) })
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment