Browse files

Little bit of work on removing backbone dependency from node. Added a…

…lphabetical sort tests.
  • Loading branch information...
1 parent 7ab9b41 commit 172d287dd7d7d8f7653e0a5867824af464464da8 @balupton balupton committed Dec 14, 2012
Showing with 28 additions and 7 deletions.
  1. +3 −0 History.md
  2. +5 −1 out/lib/query-engine.js
  3. +8 −0 out/test/sort.test.js
  4. +3 −4 package.json
  5. +4 −2 src/lib/query-engine.coffee
  6. +5 −0 src/test/sort.test.coffee
View
3 History.md
@@ -1,5 +1,8 @@
## History
+- v1.5.0 December 14, 2012
+ - Removed backbone dependency, should be handled by the parent project now
+
- v1.4.0 November 5, 2012
- Speed improvements
- We now do compiled queries
View
6 out/lib/query-engine.js
@@ -7,7 +7,11 @@
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
- Backbone = (_ref = (typeof module !== "undefined" && module !== null ? require('backbone') : this.Backbone)) != null ? _ref : null;
+ try {
+ Backbone = (_ref = (typeof module !== "undefined" && module !== null ? require('backbone') : this.Backbone)) != null ? _ref : null;
+ } catch (err) {
+ Backbone = null;
+ }
util = {
toString: function(value) {
View
8 out/test/sort.test.js
@@ -103,6 +103,14 @@
generateTestSuite = function(describe, it, collectionName, docs) {
return describe(collectionName, function(describe, it) {
describe('sortArray', function(describe, it) {
+ it('string-object', function() {
+ var actual, expected;
+ actual = queryEngine.createCollection(docs.models).sortArray({
+ title: 1
+ });
+ expected = queryEngine.createCollection([docs.get('history'), docs.get('index'), docs.get('jquery')]);
+ return assert.deepEqual(actual, expected.toJSON());
+ });
it('numeric-function', function() {
var actual, expected;
actual = queryEngine.createCollection(docs.models).sortArray(function(a, b) {
View
7 package.json
@@ -1,6 +1,6 @@
{
"name": "query-engine",
- "version": "1.4.0",
+ "version": "1.5.0",
"description": "Query-Engine is a NoSQL and MongoDb compliant query engine. It can run on the server-side with Node.js, or on the client-side within web browsers",
"homepage": "https://github.com/bevry/query-engine",
"keywords": [
@@ -35,10 +35,9 @@
"type": "git",
"url": "http://github.com/bevry/query-engine.git"
},
- "dependencies": {
- "backbone": "0.9.x"
- },
+ "dependencies": {},
"devDependencies": {
+ "backbone": "0.9.x",
"underscore": "1.4.x",
"joe": "1.1.x",
"coffee-script": "1.4.x",
View
6 src/lib/query-engine.coffee
@@ -1,6 +1,8 @@
# Requires
-Backbone = (if module? then require('backbone') else @Backbone) ? null
-
+try
+ Backbone = (if module? then require('backbone') else @Backbone) ? null
+catch err
+ Backbone = null
# Util
# Contains our utility functions
View
5 src/test/sort.test.coffee
@@ -99,6 +99,11 @@ store =
generateTestSuite = (describe, it, collectionName, docs) ->
describe collectionName, (describe,it) ->
describe 'sortArray', (describe,it) ->
+ it 'string-object', ->
+ actual = queryEngine.createCollection(docs.models).sortArray(title: 1)
+ expected = queryEngine.createCollection [docs.get('history'),docs.get('index'),docs.get('jquery')]
+ assert.deepEqual(actual, expected.toJSON())
+
it 'numeric-function', ->
actual = queryEngine.createCollection(docs.models).sortArray (a,b) -> return b.position - a.position
expected = queryEngine.createCollection [docs.get('history'),docs.get('jquery'),docs.get('index')]

0 comments on commit 172d287

Please sign in to comment.