Browse Source

Add testkit API

Ben Hsieh 8 years ago
parent
commit
8c80f94c91

+ 1
- 1
test/react-native-testkit/lib/comparer.js View File

4
   instanceOf : (a, b) => a instanceof b,
4
   instanceOf : (a, b) => a instanceof b,
5
   typeof : (a, b) => typeof a === b,
5
   typeof : (a, b) => typeof a === b,
6
   IsNull : (a, b) => a === null,
6
   IsNull : (a, b) => a === null,
7
-  exists : (a, b) => a !== void 0,
7
+  exists : (a, b) => a,
8
   hasValue : (a, b) => (a !== void 0) && (Array.isArray(a) ? a.length !==0 : true),
8
   hasValue : (a, b) => (a !== void 0) && (Array.isArray(a) ? a.length !==0 : true),
9
   isArray : (a, b) => Array.isArray(a),
9
   isArray : (a, b) => Array.isArray(a),
10
 }
10
 }

+ 4
- 1
test/react-native-testkit/lib/test-context.js View File

66
           }, this.timeout)
66
           }, this.timeout)
67
 
67
 
68
           // run test body
68
           // run test body
69
-          this.fn.bind(this)(update, data).then((...res) => {
69
+          new Promise((done) => {
70
+            this.fn.bind(this)(update, done)
71
+          })
72
+          .then((...res) => {
70
             if(!expired) {
73
             if(!expired) {
71
               clearTimeout(tm)
74
               clearTimeout(tm)
72
               updateInternal({
75
               updateInternal({