null+****@clear*****
null+****@clear*****
2012年 8月 6日 (月) 15:19:31 JST
SHIMODA Hiroshi 2012-08-06 15:19:31 +0900 (Mon, 06 Aug 2012) New Revision: 0d6e66297555a3d044359813c7d06a4cbc858ea2 https://github.com/groonga/gcs/commit/0d6e66297555a3d044359813c7d06a4cbc858ea2 Log: Add test for error case of cs-configure-fields Modified files: test/cs-commands.test.js Modified: test/cs-commands.test.js (+38 -16) =================================================================== --- test/cs-commands.test.js 2012-08-06 15:10:53 +0900 (6978c95) +++ test/cs-commands.test.js 2012-08-06 15:19:31 +0900 (e5d009f) @@ -170,10 +170,11 @@ suite('cs-configure-fields', function() { '--type', type, '--database-path', temporaryDatabase.path) .next(function(result) { - assert.equal(result.code, 0); - assert.equal(result.output.stdout, - 'Updated 1 Index Field:\n' + - name + ' RequiresIndexDocuments ' + type + ' ()\n'); + assert.deepEqual({ code: result.code, + message: result.output.stdout }, + { code: 0, + message: 'Updated 1 Index Field:\n' + + name + ' RequiresIndexDocuments ' + type + ' ()\n' }); context.reopen(); var domain = new Domain('companies', context); @@ -214,9 +215,10 @@ suite('cs-configure-fields', function() { '--delete', '--database-path', temporaryDatabase.path) .next(function(result) { - assert.equal(result.code, 0); - assert.equal(result.output.stdout, - 'Updated 1 Index Field:\n'); + assert.deepEqual({ code: result.code, + message: result.output.stdout }, + { code: 0, + message: 'Updated 1 Index Field:\n' }); context.reopen(); var domain = new Domain('companies', context); @@ -256,9 +258,10 @@ suite('cs-configure-fields', function() { '--type', type, '--database-path', temporaryDatabase.path) .next(function(result) { - assert.equal(result.code, 1); - assert.equal(result.output.stdout, - 'You must specify not-existing field name.\n'); + assert.deepEqual({ code: result.code, + message: result.output.stdout }, + { code: 1, + message: 'You must specify not-existing field name.\n' }); done(); }) .error(function(e) { @@ -287,9 +290,10 @@ suite('cs-configure-fields', function() { '--delete', '--database-path', temporaryDatabase.path) .next(function(result) { - assert.equal(result.code, 1); - assert.equal(result.output.stdout, - 'You must specify an existing field.\n'); + assert.deepEqual({ code: result.code, + message: result.output.stdout }, + { code: 1, + message: 'You must specify an existing field.\n' }); done(); }) .error(function(e) { @@ -307,9 +311,27 @@ suite('cs-configure-fields', function() { '--name', 'name', '--database-path', temporaryDatabase.path) .next(function(result) { - assert.equal(result.code, 1); - assert.equal(result.output.stdout, - 'You must specify the field type.\n'); + assert.deepEqual({ code: result.code, + message: result.output.stdout }, + { code: 1, + message: 'You must specify the field type.\n' }); + done(); + }) + .error(function(e) { + done(e); + }); + }); + + test('create field without domain', function(done) { + utils + .run('cs-configure-fields', + '--name', 'name', + '--database-path', temporaryDatabase.path) + .next(function(result) { + assert.deepEqual({ code: result.code, + message: result.output.stdout }, + { code: 1, + message: 'You must specify an existing domain name.\n' }); done(); }) .error(function(e) { -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B... 다운로드