[Groonga-commit] groonga/gcs [master] Add test for invalid input for cs-delete-domain

Zurück zum Archiv-Index

null+****@clear***** null+****@clear*****
2012年 8月 6日 (月) 15:52:06 JST


SHIMODA Hiroshi	2012-08-06 15:52:06 +0900 (Mon, 06 Aug 2012)

  New Revision: 192d23108e9a78cab89debaa4429a345db174ea2
  https://github.com/groonga/gcs/commit/192d23108e9a78cab89debaa4429a345db174ea2

  Log:
    Add test for invalid input for cs-delete-domain

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

  Modified: test/cs-commands.test.js (+30 -9)
===================================================================
--- test/cs-commands.test.js    2012-08-06 15:48:24 +0900 (c7be63d)
+++ test/cs-commands.test.js    2012-08-06 15:52:06 +0900 (06b3e90)
@@ -52,9 +52,10 @@ suite('cs-create-domain', function() {
            '--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.');
+        assert.deepEqual({ code:    result.code,
+                           message: result.output.stdout },
+                         { code:    1,
+                           message: 'The domain [test] already exists.\n' });
 
         context.reopen();
         var domains = Domain.getAll(context).map(function(domain) {
@@ -74,9 +75,10 @@ suite('cs-create-domain', function() {
       .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.');
+        assert.deepEqual({ code:    result.code,
+                           message: result.output.stdout },
+                         { code:    1,
+                           message: 'You must specify the domain name.\n' });
 
         context.reopen();
         assert.deepEqual(Domain.getAll(context), []);
@@ -103,9 +105,10 @@ suite('cs-delete-domain', function() {
            '--force',
            '--database-path', temporaryDatabase.path)
       .next(function(result) {
-        assert.equal(result.code, 0);
-        assert.include(result.output.stdout,
-                       'Domain [test] has been deleted successfully.');
+        assert.deepEqual({ code:    result.code,
+                           message: result.output.stdout },
+                         { code:    0,
+                           message: 'Domain [test] has been deleted successfully.\n' });
 
         context.reopen();
         var domain = new Domain('test', context);
@@ -117,6 +120,24 @@ suite('cs-delete-domain', function() {
         done(e);
       });
   });
+
+  test('delete unexisting domain', function(done) {
+    utils
+      .run('cs-delete-domain',
+           '--domain-name', 'test',
+           '--force',
+           '--database-path', temporaryDatabase.path)
+      .next(function(result) {
+        assert.deepEqual({ code:    result.code,
+                           message: result.output.stdout },
+                         { code:    1,
+                           message: 'You must specify the domain name\n' });
+        done();
+      })
+      .error(function(e) {
+        done(e);
+      });
+  });
 });
 
 suite('cs-describe-domain', function() {
-------------- next part --------------
HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-commit メーリングリストの案内
Zurück zum Archiv-Index