Skip to content
This repository
Browse code

Rearrange the shared adapter tests a bit

  • Loading branch information...
commit fc5c75e5c386c0dc0d9d4bb0c825aab97d8fbbdb 1 parent c63e255
Matthew Eernisse authored March 24, 2013

Showing 1 changed file with 28 additions and 19 deletions. Show diff stats Hide diff stats

  1. 47  test/adapters/shared.js
47  test/adapters/shared.js
@@ -10,34 +10,43 @@ var utils = require('utilities')
10 10
 
11 11
 tests = {
12 12
 
13  
-  'test save new, string UUID id': function (next) {
  13
+  'test save new, string UUID id, required nunmber is 0': function (next) {
14 14
     var z = Zooby.create({
15  
-      foo: 'ZOO'
  15
+      foo: 'GROO'
16 16
     , zong: new Date()
17  
-    , mar: 1
18  
-    });
19  
-    z.save(function (err, data) {
20  
-      if (err) {
21  
-        throw err;
22  
-      }
23  
-      currentId = z.id;
24  
-      next();
  17
+    , mar: 0
25 18
     });
  19
+    if (z.isValid()) {
  20
+      z.save(function (err, data) {
  21
+        if (err) {
  22
+          throw err;
  23
+        }
  24
+        next();
  25
+      });
  26
+    }
  27
+    else {
  28
+      throw new Error('model is not valid');
  29
+    }
26 30
   }
27 31
 
28  
-  ,'test save new, required integer set to 0 UUID id': function (next) {
  32
+, 'test save new, string UUID id, required number is 1': function (next) {
29 33
     var z = Zooby.create({
30 34
       foo: 'ZOO'
31 35
     , zong: new Date()
32  
-    , mar: 0
33  
-    });
34  
-    z.save(function (err, data) {
35  
-      if (err) {
36  
-        throw err;
37  
-      }
38  
-      currentId = z.id;
39  
-      next();
  36
+    , mar: 1
40 37
     });
  38
+    if (z.isValid()) {
  39
+      z.save(function (err, data) {
  40
+        if (err) {
  41
+          throw err;
  42
+        }
  43
+        currentId = z.id;
  44
+        next();
  45
+      });
  46
+    }
  47
+    else {
  48
+      throw new Error('model is not valid');
  49
+    }
41 50
   }
42 51
 
43 52
 , 'test first via string id': function (next) {

0 notes on commit fc5c75e

Please sign in to comment.
Something went wrong with that request. Please try again.