[Groonga-commit] droonga/express-droonga at 9ecce5a [master] test: add a test for no _key case

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Apr 25 13:53:03 JST 2014


Kouhei Sutou	2014-04-25 13:53:03 +0900 (Fri, 25 Apr 2014)

  New Revision: 9ecce5a80231fa394ab49de06835044da117db9d
  https://github.com/droonga/express-droonga/commit/9ecce5a80231fa394ab49de06835044da117db9d

  Message:
    test: add a test for no _key case

  Modified files:
    test/adapter/api/groonga/load.test.js

  Modified: test/adapter/api/groonga/load.test.js (+37 -7)
===================================================================
--- test/adapter/api/groonga/load.test.js    2014-04-25 13:51:59 +0900 (27ea29b)
+++ test/adapter/api/groonga/load.test.js    2014-04-25 13:53:03 +0900 (c09b4fc)
@@ -123,6 +123,36 @@ suite('adapter/api/groonga: load', function() {
     });
 
     suite('object style', function() {
+      test('no _key', function(done) {
+        var requestBody;
+        backend.reserveResponse(function(requestPacket) {
+          requestBody = requestPacket[2].body;
+          return utils.createReplyPacket(requestPacket, successMessage);
+        });
+        var body = [
+          {
+            title: 'Droonga',
+            content: 'Droonga is fun!'
+          }
+        ]
+        utils.post('/d/load?table=Memos', JSON.stringify(body))
+          .next(function(response) {
+            try {
+              assert.deepEqual(requestBody,
+                               {
+                                 table: 'Memos',
+                                 values: {
+                                   title: 'Droonga',
+                                   content: 'Droonga is fun!'
+                                 }
+                               });
+              done();
+            } catch (error) {
+              done(error);
+            }
+          });
+      });
+
       test('with columns', function(done) {
         var requestBody;
         backend.reserveResponse(function(requestPacket) {
@@ -141,13 +171,13 @@ suite('adapter/api/groonga: load', function() {
             try {
               assert.deepEqual(requestBody,
                                {
-                                table: 'Users',
-                                key: 'alice',
-                                values: {
-                                  name: 'Alice',
-                                  age: 20
-                                }
-                              });
+                                 table: 'Users',
+                                 key: 'alice',
+                                 values: {
+                                   name: 'Alice',
+                                   age: 20
+                                 }
+                               });
               done();
             } catch (error) {
               done(error);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index