[Groonga-commit] groonga/gcs [master] Update tests for DeleteIndexField

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 2日 (木) 14:03:43 JST


SHIMODA Hiroshi	2012-08-02 14:03:43 +0900 (Thu, 02 Aug 2012)

  New Revision: a799bda80a7525dbd224b64dfc60b96aa59d3f9e
  https://github.com/groonga/gcs/commit/a799bda80a7525dbd224b64dfc60b96aa59d3f9e

  Log:
    Update tests for DeleteIndexField

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

  Modified: test/api-configuration.test.js (+29 -26)
===================================================================
--- test/api-configuration.test.js    2012-08-02 13:58:57 +0900 (50320b3)
+++ test/api-configuration.test.js    2012-08-02 14:03:43 +0900 (7b148e6)
@@ -420,6 +420,7 @@ suite('Configuration API', function() {
   });
 
   test('Get, Action=DeleteIndexField (text)', function(done) {
+    var domain, field;
     utils
       .get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
         'Host': 'cloudsearch.localhost'
@@ -427,17 +428,17 @@ suite('Configuration API', function() {
       .get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
            'IndexField.IndexFieldType=text&' +
            'Action=DefineIndexField&Version=2011-02-01')
+      .next(function() {
+        domain = new Domain('companies', context);
+        field = domain.getIndexField('name');
+      }),
       .get('/?DomainName=companies&IndexFieldName=name&' +
            'Action=DeleteIndexField&Version=2011-02-01')
       .next(function(response) {
-        var dump = context.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies_00000000000000000000000000 TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_00000000000000000000000000_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram';
-        assert.equal(dump, expected);
+        assert.deepEqual({ domain: domain.exists(),
+                           field:  domain.field() },
+                         { domain: true,
+                           field:  faldomain.field() });
 
         response = toParsedResponse(response);
         assert.deepEqual(response.pattern,
@@ -452,6 +453,7 @@ suite('Configuration API', function() {
   });
 
   test('Get, Action=DeleteIndexField (uint)', function(done) {
+    var domain, field;
     utils
       .get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
         'Host': 'cloudsearch.localhost'
@@ -459,17 +461,17 @@ suite('Configuration API', function() {
       .get('/?DomainName=companies&IndexField.IndexFieldName=age&' +
            'IndexField.IndexFieldType=uint&' +
            'Action=DefineIndexField&Version=2011-02-01')
+      .next(function() {
+        domain = new Domain('companies', context);
+        field = domain.getIndexField('age');
+      }),
       .get('/?DomainName=companies&IndexFieldName=age&' +
            'Action=DeleteIndexField&Version=2011-02-01')
       .next(function(response) {
-        var dump = context.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies_00000000000000000000000000 TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_00000000000000000000000000_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram';
-        assert.equal(dump, expected);
+        assert.deepEqual({ domain: domain.exists(),
+                           field:  domain.field() },
+                         { domain: true,
+                           field:  faldomain.field() });
 
         response = toParsedResponse(response);
         assert.deepEqual(response.pattern,
@@ -484,24 +486,25 @@ suite('Configuration API', function() {
   });
 
   test('Get, Action=DeleteIndexField (literal)', function(done) {
+    var domain, field;
     utils
       .get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
         'Host': 'cloudsearch.localhost'
       })
-      .get('/?DomainName=companies&IndexField.IndexFieldName=member&' +
+      .get('/?DomainName=companies&IndexField.IndexFieldName=product&' +
            'IndexField.IndexFieldType=literal&' +
            'Action=DefineIndexField&Version=2011-02-01')
-      .get('/?DomainName=companies&IndexFieldName=member&' +
+      .next(function() {
+        domain = new Domain('companies', context);
+        field = domain.getIndexField('product');
+      }),
+      .get('/?DomainName=companies&IndexFieldName=product&' +
            'Action=DeleteIndexField&Version=2011-02-01')
       .next(function(response) {
-        var dump = context.commandSync('dump', {
-              tables: 'companies'
-            });
-        var expected = 'table_create companies_00000000000000000000000000 TABLE_HASH_KEY ShortText\n' +
-                       'table_create companies_00000000000000000000000000_BigramTerms ' +
-                         'TABLE_PAT_KEY|KEY_NORMALIZE ShortText ' +
-                         '--default_tokenizer TokenBigram';
-        assert.equal(dump, expected);
+        assert.deepEqual({ domain: domain.exists(),
+                           field:  domain.field() },
+                         { domain: true,
+                           field:  faldomain.field() });
 
         response = toParsedResponse(response);
         assert.deepEqual(response.pattern,
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



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