Added UsergridQuery 'not' test and renamed test files to .test.js
diff --git a/tests/index.js b/tests/index.js
deleted file mode 100644
index 90b98de..0000000
--- a/tests/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-describe.skip('Usergrid', function() {
- return require('./lib/usergrid')
-})
-
-describe.skip('UsergridClient', function() {
- return require('./lib/client')
-})
-
-describe('UsergridQuery', function() {
- return require('./lib/query')
-})
\ No newline at end of file
diff --git a/tests/lib/client.js b/tests/lib/client.test.js
similarity index 100%
rename from tests/lib/client.js
rename to tests/lib/client.test.js
diff --git a/tests/lib/query.js b/tests/lib/query.test.js
similarity index 72%
rename from tests/lib/query.js
rename to tests/lib/query.test.js
index ccdf767..fce0979 100644
--- a/tests/lib/query.js
+++ b/tests/lib/query.test.js
@@ -29,7 +29,6 @@
})
describe('_ql', function() {
- var q1 = "select * where weight > 2.4 and color contains 'bl*' and not color = 'blue' or color = 'orange'"
it('should support complex builder syntax (chained constructor methods)', function() {
var query = new UsergridQuery('cats')
.gt('weight', 2.4)
@@ -38,41 +37,43 @@
.eq('color', 'blue')
.or
.eq('color', 'orange')
- query.should.have.property('_ql').equal(q1)
+ query.should.have.property('_ql').equal("select * where weight > 2.4 and color contains 'bl*' and not color = 'blue' or color = 'orange'")
})
- var q2 = "select * where color = 'black'"
+ it('not operator should precede conditional statement', function() {
+ var query = new UsergridQuery('cats')
+ .not
+ .eq('color', 'white')
+ query.should.have.property('_ql').equal("select * where not color = 'white'")
+ })
+
it('string values should be contained in single quotes', function() {
var query = new UsergridQuery('cats')
.eq('color', 'black')
- query.should.have.property('_ql').equal(q2)
+ query.should.have.property('_ql').equal("select * where color = 'black'")
})
- var q3 = "select * where longHair = true"
it('boolean values should not be contained in single quotes', function() {
var query = new UsergridQuery('cats')
.eq('longHair', true)
- query.should.have.property('_ql').equal(q3)
+ query.should.have.property('_ql').equal("select * where longHair = true")
})
- var q4 = "select * where weight < 18"
it('float values should not be contained in single quotes', function() {
var query = new UsergridQuery('cats')
.lt('weight', 18)
- query.should.have.property('_ql').equal(q4)
+ query.should.have.property('_ql').equal("select * where weight < 18")
})
- var q5 = "select * where weight >= 2"
it('integer values should not be contained in single quotes', function() {
var query = new UsergridQuery('cats')
.gte('weight', 2)
- query.should.have.property('_ql').equal(q5)
+ query.should.have.property('_ql').equal("select * where weight >= 2")
})
- var q6 = "select * where uuid = a61e29ba-944f-11e5-8690-fbb14f62c803"
it('uuid values should not be contained in single quotes', function() {
var query = new UsergridQuery('cats')
.eq('uuid', 'a61e29ba-944f-11e5-8690-fbb14f62c803')
- query.should.have.property('_ql').equal(q6)
+ query.should.have.property('_ql').equal("select * where uuid = a61e29ba-944f-11e5-8690-fbb14f62c803")
})
})
\ No newline at end of file
diff --git a/tests/lib/usergrid.js b/tests/lib/usergrid.test.js
similarity index 100%
rename from tests/lib/usergrid.js
rename to tests/lib/usergrid.test.js
diff --git a/tests/main.js b/tests/main.js
new file mode 100644
index 0000000..dd9fadc
--- /dev/null
+++ b/tests/main.js
@@ -0,0 +1,13 @@
+'use strict'
+
+describe.skip('Usergrid', function() {
+ return require('./lib/usergrid.test')
+})
+
+describe.skip('UsergridClient', function() {
+ return require('./lib/client.test')
+})
+
+describe('UsergridQuery', function() {
+ return require('./lib/query.test')
+})
\ No newline at end of file