[Groonga-commit] groonga/gcs [master] Add tests for invalid use of cs-create-domain command

Back to archive index

null+****@clear***** null+****@clear*****
2012年 8月 6日 (月) 12:57:28 JST


SHIMODA Hiroshi	2012-08-06 12:57:28 +0900 (Mon, 06 Aug 2012)

  New Revision: 2e5884b57a84110eb165e1a33068d40c6fc08cd1
  https://github.com/groonga/gcs/commit/2e5884b57a84110eb165e1a33068d40c6fc08cd1

  Log:
    Add tests for invalid use of cs-create-domain command

  Modified files:
    test/cs-commands.test.js

  Modified: test/cs-commands.test.js (+39 -0)
===================================================================
--- test/cs-commands.test.js    2012-08-06 12:54:09 +0900 (69caf99)
+++ test/cs-commands.test.js    2012-08-06 12:57:28 +0900 (2a7f64d)
@@ -39,4 +39,43 @@ suite('cs-create-domain', function() {
         done();
       });
   });
+
+  test('create again', function(done) {
+    utils
+      .run('cs-create-domain',
+           '--domain-name', 'test',
+           '--database-path', temporaryDatabase.path)
+      .run('cs-create-domain',
+           '--domain-name', 'test',
+           '--database-path', temporaryDatabase.path)
+      .next(function(result) {
+        assert.equal(result.code, 1);
+        assert.include(result.output.stdout,
+                       'The domain [test] already exists.');
+
+        context.reopen();
+        var domains = Domain.getAll(context).map(function(domain) {
+              return domain.name;
+            });
+        assert.deepEqual(domains, ['test']);
+
+        done();
+      });
+  });
+
+  test('missing domain name', function(done) {
+    utils
+      .run('cs-create-domain',
+           '--database-path', temporaryDatabase.path)
+      .next(function(result) {
+        assert.equal(result.code, 1);
+        assert.include(result.output.stdout,
+                       'You must specify the domain name.');
+
+        context.reopen();
+        assert.deepEqual(Domain.getAll(context), []);
+
+        done();
+      });
+  });
 });
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



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