blob: abde6315ad2a9684d340ab22d7a9f2520c61a9d5 [file] [log] [blame]
'use strict'
var should = require('should'),
config = require('../../config.json'),
UsergridClient = require('../../lib/client'),
UsergridQuery = require('../../lib/query')
describe('type', function() {
it('query._type should equal \'cats\' when passing \'type\' as a parameter to UsergridQuery', function() {
var query = new UsergridQuery('cats')
query.should.have.property('_type').equal('cats')
})
it('query._type should equal \'cats\' when calling .type() builder method', function() {
var query = new UsergridQuery().type('cats')
query.should.have.property('_type').equal('cats')
})
it('query._type should equal \'cats\' when calling .collection() builder method', function() {
var query = new UsergridQuery().collection('cats')
query.should.have.property('_type').equal('cats')
})
})
describe('limit', function() {
it('query._limit should equal 10', function() {
var query = new UsergridQuery('cats').limit(10)
query.should.have.property('_limit').equal(10)
})
})
describe('eq', function() {
it('query._ql should equal \"select * where color = \'black\'\"', function() {
var query = new UsergridQuery().collection('cats').eq('color', 'black')
query.should.have.property('_ql').equal('select * where color = \'black\'')
})
})
// console.log(.desc('color').ql)
// console.log(new UsergridQuery().collection('cats').gt('weight', 2.4).desc('color').ql)
// console.log(new UsergridQuery().collection('cats').limit(10).limit)