Update query changes.
Project: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/commit/a5fdb4df Tree: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/tree/a5fdb4df Diff: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/diff/a5fdb4df Branch: refs/heads/master Commit: a5fdb4df49dee9e41b127ba6c7c4239841d29d93 Parents: 49227ed Author: Robert Walsh <[email protected]> Authored: Mon Oct 10 12:24:36 2016 -0500 Committer: Robert Walsh <[email protected]> Committed: Mon Oct 10 12:24:36 2016 -0500 ---------------------------------------------------------------------- lib/query.js | 7 ++----- tests/lib/query.test.js | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/a5fdb4df/lib/query.js ---------------------------------------------------------------------- diff --git a/lib/query.js b/lib/query.js index 87daf7d..8afcb91 100644 --- a/lib/query.js +++ b/lib/query.js @@ -118,14 +118,11 @@ var UsergridQuery = function(type) { // public accessors Object.defineProperty(self, '_ql', { get: function() { - var ql = 'select * ' if (queryString !== undefined) { - ql = queryString + return queryString } else { - ql += ((query.length > 0) ? 'where ' + (query || '') : '') - ql += ((sort !== undefined) ? sort : '') + return util.format('select * %s %s', ((query.length > 0) ? 'where ' + (query || '') : ''),((sort !== undefined) ? sort : '')) } - return ql } }) http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/a5fdb4df/tests/lib/query.test.js ---------------------------------------------------------------------- diff --git a/tests/lib/query.test.js b/tests/lib/query.test.js index 7ec9cb4..65f9c1a 100644 --- a/tests/lib/query.test.js +++ b/tests/lib/query.test.js @@ -33,7 +33,7 @@ describe('_limit', function() { }) describe('_ql', function() { - it('should select * if query or sort are empty or underfined', function() { + it('should equal \'select *\' if query or sort are empty or underfined', function() { var query = new UsergridQuery('cats') query.should.have.property('_ql').equal('select * ') })
