From 1a5a4fdc5c6d01c4d0dea714f999c5cb75349901 Mon Sep 17 00:00:00 2001 From: Anny He Date: Thu, 16 Feb 2017 16:06:37 -0800 Subject: [PATCH] minor fix --- api/v1/controllers/subjects.js | 6 +----- api/v1/controllers/utils.js | 10 ++++++++++ api/v1/helpers/verbs/utils.js | 2 +- .../getHierarchyAspectAndTagsFilters.js | 20 ++++++++----------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/api/v1/controllers/subjects.js b/api/v1/controllers/subjects.js index 4b8d022c59..e534ce157d 100644 --- a/api/v1/controllers/subjects.js +++ b/api/v1/controllers/subjects.js @@ -195,11 +195,7 @@ module.exports = { // Filter Parameter Validation for (let i = 0; i < filterParams.length; i++) { if (params[filterParams[i]].value) { - - - - - (params[filterParams[i]].value.split(',')); + validateFilterParams(params[filterParams[i]].value.split(',')); } } diff --git a/api/v1/controllers/utils.js b/api/v1/controllers/utils.js index f107dec669..0f9026a3c2 100644 --- a/api/v1/controllers/utils.js +++ b/api/v1/controllers/utils.js @@ -1,4 +1,14 @@ +/** + * Copyright (c) 2016, salesforce.com, inc. + * All rights reserved. + * Licensed under the BSD 3-Clause license. + * For full license text, see LICENSE.txt file in the repo root or + * https://opensource.org/licenses/BSD-3-Clause + */ +/** + * api/v1/controllers/utils.js + */ const ZERO = 0; const ONE = 1; diff --git a/api/v1/helpers/verbs/utils.js b/api/v1/helpers/verbs/utils.js index fc71971dba..3574c4fd32 100644 --- a/api/v1/helpers/verbs/utils.js +++ b/api/v1/helpers/verbs/utils.js @@ -7,7 +7,7 @@ */ /** - * api/v1/controllers/utils.js + * api/v1/helpers/verbs/utils.js */ 'use strict'; diff --git a/tests/api/v1/subjects/getHierarchyAspectAndTagsFilters.js b/tests/api/v1/subjects/getHierarchyAspectAndTagsFilters.js index 63360f1fba..a48883ff49 100644 --- a/tests/api/v1/subjects/getHierarchyAspectAndTagsFilters.js +++ b/tests/api/v1/subjects/getHierarchyAspectAndTagsFilters.js @@ -245,15 +245,13 @@ describe(`api: GET ${path}:`, () => { api.get(endpoint) .set('Authorization', token) .expect(constants.httpStatus.BAD_REQUEST) - .expect((res) => { - expect(res.body.errors[0].type).to - .equal('InvalidFilterParameterError'); - }) - .end((err /* , res */) => { + .end((err, res ) => { if (err) { return done(err); } + expect(res.body.errors[0].type).to + .equal('InvalidFilterParameterError'); done(); }); }); @@ -374,7 +372,11 @@ describe(`api: GET ${path}:`, () => { api.get(endpoint2) .set('Authorization', token) .expect(constants.httpStatus.OK) - .expect((res) => { + .end((err, res ) => { + if (err) { + return done(err); + } + expect(res.body).to.not.equal(null); expect(res.body.samples).to.have.length(2); expect(res.body.samples[1]).to.have.deep @@ -384,12 +386,6 @@ describe(`api: GET ${path}:`, () => { expect(res.body.children[0].children).to.have.length(0); expect(res.body.children[0].samples[0]).to.have.deep .property('aspect.name', 'humidity'); - }) - .end((err /* , res */) => { - if (err) { - return done(err); - } - done(); }); });