Skip to content

Commit

Permalink
Get sorting tests working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Sep 3, 2012
1 parent 6b3facb commit d069e3e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/adapters/shared.js
Expand Up @@ -11,7 +11,10 @@ var utils = require('utilities')
tests = { tests = {


'test save new, string UUID id': function (next) { 'test save new, string UUID id': function (next) {
var z = Zooby.create({foo: 'FOO'}); var z = Zooby.create({
foo: 'FOO'
, zong: new Date()
});
z.save(function (err, data) { z.save(function (err, data) {
if (err) { if (err) {
throw err; throw err;
Expand Down Expand Up @@ -149,7 +152,7 @@ tests = {


, 'test all, sort array column names': function (next) { , 'test all, sort array column names': function (next) {
Zooby.all({}, {sort: ['foo', 'zong']}, function (err, data) { Zooby.all({}, {sort: ['foo', 'zong']}, function (err, data) {
// Should be sorted BAR, BAZ, FOO // Should be BAR, BAZ, FOO, ZZZ
assert.equal(data[0].id, testItems[1].id); assert.equal(data[0].id, testItems[1].id);
if (err) { if (err) {
throw err; throw err;
Expand All @@ -158,9 +161,9 @@ tests = {
}); });
} }


/*
, 'test all, sort object literal desc': function (next) { , 'test all, sort object literal desc': function (next) {
Zooby.all({}, {sort: {zong: 'desc'}}, function (err, data) { Zooby.all({}, {sort: {zong: 'desc'}}, function (err, data) {
// Should be sorted ZZZ, FOO, BAR, BAZ
// Sort by datetime // Sort by datetime
assert.equal(data[0].id, currentId); assert.equal(data[0].id, currentId);
if (err) { if (err) {
Expand All @@ -181,7 +184,6 @@ tests = {
}); });
} }


*/
, 'test all, sort incorrect sort direction': function () { , 'test all, sort incorrect sort direction': function () {
assert.throws(function () { assert.throws(function () {
Zooby.all({}, {sort: {foo: 'asc', bar: 'descX'}}, function (err, data) { Zooby.all({}, {sort: {foo: 'asc', bar: 'descX'}}, function (err, data) {
Expand Down

0 comments on commit d069e3e

Please sign in to comment.