[Groonga-commit] groonga/gcs [master] Assert API responses after dump assertions

Back to archive index

null+****@clear***** null+****@clear*****
2012年 7月 9日 (月) 18:49:49 JST


SHIMODA Hiroshi	2012-07-09 18:49:49 +0900 (Mon, 09 Jul 2012)

  New Revision: 96f504f30a58de753974e0743a25856465fa2296
  https://github.com/groonga/gcs/commit/96f504f30a58de753974e0743a25856465fa2296

  Log:
    Assert API responses after dump assertions

  Modified files:
    test/api-configuration.test.js

  Modified: test/api-configuration.test.js (+97 -97)
===================================================================
--- test/api-configuration.test.js    2012-07-09 18:45:58 +0900 (68b60c3)
+++ test/api-configuration.test.js    2012-07-09 18:49:49 +0900 (67d57fe)
@@ -39,6 +39,15 @@ suite('Configuration API', function() {
                 'Host': 'cloudsearch.localhost'
               })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -68,15 +77,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(response, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -95,6 +95,11 @@ suite('Configuration API', function() {
                });
       })
       .next(function(response) {
+        var dump = database.commandSync('dump');
+        // var expected = '';
+        var expected = undefined; // nroonga returns undefined for a blank database!
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -124,11 +129,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(response, expected);
 
-        var dump = database.commandSync('dump');
-        // var expected = '';
-        var expected = undefined; // nroonga returns undefined for a blank database!
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -148,6 +148,18 @@ suite('Configuration API', function() {
         return utils.get(path);
       })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'column_create companies name COLUMN_SCALAR ShortText\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram\n' +
+                       'column_create companies_BigramTerms companies_name ' +
+                         'COLUMN_INDEX|WITH_POSITION companies name';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -184,18 +196,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(actual, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'column_create companies name COLUMN_SCALAR ShortText\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram\n' +
-                       'column_create companies_BigramTerms companies_name ' +
-                         'COLUMN_INDEX|WITH_POSITION companies name';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -215,6 +215,20 @@ suite('Configuration API', function() {
         return utils.get(path);
       })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'column_create companies age COLUMN_SCALAR UInt32\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram\n' +
+                       'table_create companies_age ' +
+                         'TABLE_HASH_KEY UInt32\n' +
+                       'column_create companies_age companies_age ' +
+                         'COLUMN_INDEX|WITH_POSITION companies age';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -249,20 +263,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(actual, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'column_create companies age COLUMN_SCALAR UInt32\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram\n' +
-                       'table_create companies_age ' +
-                         'TABLE_HASH_KEY UInt32\n' +
-                       'column_create companies_age companies_age ' +
-                         'COLUMN_INDEX|WITH_POSITION companies age';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -282,6 +282,20 @@ suite('Configuration API', function() {
         return utils.get(path);
       })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram\n' +
+                       'table_create companies_member ' +
+                         'TABLE_HASH_KEY ShortText\n' +
+                       'column_create companies_member companies_member ' +
+                         'COLUMN_INDEX|WITH_POSITION companies member\n' +
+                       'column_create companies member COLUMN_SCALAR companies_member';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -319,20 +333,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(actual, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram\n' +
-                       'table_create companies_member ' +
-                         'TABLE_HASH_KEY ShortText\n' +
-                       'column_create companies_member companies_member ' +
-                         'COLUMN_INDEX|WITH_POSITION companies member\n' +
-                       'column_create companies member COLUMN_SCALAR companies_member';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -357,6 +357,15 @@ suite('Configuration API', function() {
         return utils.get(path);
       })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -373,15 +382,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(actual, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -406,6 +406,15 @@ suite('Configuration API', function() {
         return utils.get(path);
       })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -422,15 +431,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(actual, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -455,6 +455,15 @@ suite('Configuration API', function() {
         return utils.get(path);
       })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -471,15 +480,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(actual, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
@@ -509,6 +509,22 @@ suite('Configuration API', function() {
         return utils.get(path);
       })
       .next(function(response) {
+        var dump = database.commandSync('dump', {
+              tables: 'companies'
+            });
+        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
+                       'column_create companies age COLUMN_SCALAR UInt32\n' +
+                       'column_create companies name COLUMN_SCALAR ShortText\n' +
+                       'table_create companies_BigramTerms ' +
+                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
+                         '--default_tokenizer TokenBigram\n' +
+                       'table_create companies_age TABLE_HASH_KEY UInt32\n' +
+                       'column_create companies_age companies_age ' +
+                         'COLUMN_INDEX|WITH_POSITION companies age\n' +
+                       'column_create companies_BigramTerms companies_name ' +
+                         'COLUMN_INDEX|WITH_POSITION companies name';
+        assert.equal(dump, expected);
+
         var expected = {
               statusCode: 200,
               body: '<?xml version="1.0"?>\n' +
@@ -529,22 +545,6 @@ suite('Configuration API', function() {
             };
         assert.deepEqual(actual, expected);
 
-        var dump = database.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies TABLE_HASH_KEY ShortText\n' +
-                       'column_create companies age COLUMN_SCALAR UInt32\n' +
-                       'column_create companies name COLUMN_SCALAR ShortText\n' +
-                       'table_create companies_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram\n' +
-                       'table_create companies_age TABLE_HASH_KEY UInt32\n' +
-                       'column_create companies_age companies_age ' +
-                         'COLUMN_INDEX|WITH_POSITION companies age\n' +
-                       'column_create companies_BigramTerms companies_name ' +
-                         'COLUMN_INDEX|WITH_POSITION companies name';
-        assert.equal(dump, expected);
-
         done();
       })
       .error(function(error) {
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Back to archive index