null+****@clear*****
null+****@clear*****
2012年 8月 6日 (月) 15:10:53 JST
SHIMODA Hiroshi 2012-08-06 15:10:53 +0900 (Mon, 06 Aug 2012) New Revision: f2746f4dfc0d955ca5ffc3953d3c2491186625b4 https://github.com/groonga/gcs/commit/f2746f4dfc0d955ca5ffc3953d3c2491186625b4 Log: Add more tests for cs-configure-fields Modified files: test/cs-commands.test.js Modified: test/cs-commands.test.js (+77 -0) =================================================================== --- test/cs-commands.test.js 2012-08-06 15:04:34 +0900 (99ab575) +++ test/cs-commands.test.js 2012-08-06 15:10:53 +0900 (6978c95) @@ -239,4 +239,81 @@ suite('cs-configure-fields', function() { test('delete literal field', function(done) { testDeleteField(done, 'product', 'literal'); }); + + function testRecreateField(done, name, type) { + utils + .run('cs-create-domain', + '--domain-name', 'companies', + '--database-path', temporaryDatabase.path) + .run('cs-configure-fields', + '--domain-name', 'companies', + '--name', name, + '--type', type, + '--database-path', temporaryDatabase.path) + .run('cs-configure-fields', + '--domain-name', 'companies', + '--name', name, + '--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'); + done(); + }) + .error(function(e) { + done(e); + }); + } + + test('re-create text field', function(done) { + testRecreateField(done, 'name', 'text'); + }); + test('re-create uint field', function(done) { + testRecreateField(done, 'age', 'uint'); + }); + test('re-create literal field', function(done) { + testRecreateField(done, 'product', 'literal'); + }); + + test('delete not-existing field', function(done) { + utils + .run('cs-create-domain', + '--domain-name', 'companies', + '--database-path', temporaryDatabase.path) + .run('cs-configure-fields', + '--domain-name', 'companies', + '--name', 'name', + '--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'); + done(); + }) + .error(function(e) { + done(e); + }); + }); + + test('create field without type', function(done) { + utils + .run('cs-create-domain', + '--domain-name', 'companies', + '--database-path', temporaryDatabase.path) + .run('cs-configure-fields', + '--domain-name', 'companies', + '--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'); + done(); + }) + .error(function(e) { + done(e); + }); + }); }); -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download