Permalink
Browse files

Rearrange the shared adapter tests a bit

  • Loading branch information...
1 parent c63e255 commit fc5c75e5c386c0dc0d9d4bb0c825aab97d8fbbdb mde committed Mar 24, 2013
Showing with 28 additions and 19 deletions.
  1. +28 −19 test/adapters/shared.js
View
@@ -10,34 +10,43 @@ var utils = require('utilities')
tests = {
- 'test save new, string UUID id': function (next) {
+ 'test save new, string UUID id, required nunmber is 0': function (next) {
var z = Zooby.create({
- foo: 'ZOO'
+ foo: 'GROO'
, zong: new Date()
- , mar: 1
- });
- z.save(function (err, data) {
- if (err) {
- throw err;
- }
- currentId = z.id;
- next();
+ , mar: 0
});
+ if (z.isValid()) {
+ z.save(function (err, data) {
+ if (err) {
+ throw err;
+ }
+ next();
+ });
+ }
+ else {
+ throw new Error('model is not valid');
+ }
}
- ,'test save new, required integer set to 0 UUID id': function (next) {
+, 'test save new, string UUID id, required number is 1': function (next) {
var z = Zooby.create({
foo: 'ZOO'
, zong: new Date()
- , mar: 0
- });
- z.save(function (err, data) {
- if (err) {
- throw err;
- }
- currentId = z.id;
- next();
+ , mar: 1
});
+ if (z.isValid()) {
+ z.save(function (err, data) {
+ if (err) {
+ throw err;
+ }
+ currentId = z.id;
+ next();
+ });
+ }
+ else {
+ throw new Error('model is not valid');
+ }
}
, 'test first via string id': function (next) {

0 comments on commit fc5c75e

Please sign in to comment.