YUKI Hiroshi
null+****@clear*****
Mon Nov 5 15:01:24 JST 2012
YUKI Hiroshi 2012-11-05 15:01:24 +0900 (Mon, 05 Nov 2012) New Revision: 8a79d563d39af60fa398b653249399fe6999e037 https://github.com/groonga/gcs/commit/8a79d563d39af60fa398b653249399fe6999e037 Log: Update test for validation error from invalid domain names Modified files: test/database-domain.test.js Modified: test/database-domain.test.js (+33 -5) =================================================================== --- test/database-domain.test.js 2012-11-05 15:01:14 +0900 (c941151) +++ test/database-domain.test.js 2012-11-05 15:01:24 +0900 (95ccd76) @@ -35,10 +35,32 @@ suite('database', function() { 'valid123_' + Domain.DEFAULT_ID); }); - test('too short', function() { + test('without name', function() { + assert.throw(function() { + var domain = new Domain(''); + }, '2 validation errors detected: ' + + 'Value \'\' at \'domainName\' failed to satisfy constraint: ' + + 'Member must satisfy regular expression pattern: [a-z][a-z0-9\\-]+; ' + + 'Value \'\' at \'domainName\' failed to satisfy constraint: ' + + 'Member must have length greater than or equal to 3'); + }); + + test('too short (1 character)', function() { + assert.throw(function() { + var domain = new Domain('v'); + }, '2 validation errors detected: ' + + 'Value \'v\' at \'domainName\' failed to satisfy constraint: ' + + 'Member must satisfy regular expression pattern: [a-z][a-z0-9\\-]+; ' + + 'Value \'v\' at \'domainName\' failed to satisfy constraint: ' + + 'Member must have length greater than or equal to 3'); + }); + + test('too short (2 characters)', function() { assert.throw(function() { var domain = new Domain('va'); - }, /too short domain name/); + }, '1 validation errors detected: ' + + 'Value \'va\' at \'domainName\' failed to satisfy constraint: ' + + 'Member must have length greater than or equal to 3'); }); test('too long', function() { @@ -51,19 +73,25 @@ suite('database', function() { test('hyphen', function() { assert.throw(function() { var domain = new Domain('domain-name'); - }, /"-" cannot appear in a domain name/); + }, '1 validation errors detected: ' + + 'Value \'domain_name\' at \'domainName\' failed to satisfy constraint: ' + + 'Member cannot include these characters: \'-\''); }); test('underscore', function() { assert.throw(function() { var domain = new Domain('domain_name'); - }, /"_" cannot appear in a domain name/); + }, '1 validation errors detected: ' + + 'Value \'domain_name\' at \'domainName\' failed to satisfy constraint: ' + + 'Member must satisfy regular expression pattern: [a-z][a-z0-9\\-]+'); }); test('upper case', function() { assert.throw(function() { var domain = new Domain('DomainName'); - }, /"D", "N" cannot appear in a domain name/); + }, '1 validation errors detected: ' + + 'Value \'DomainName\' at \'domainName\' failed to satisfy constraint: ' + + 'Member must satisfy regular expression pattern: [a-z][a-z0-9\\-]+'); }); test('termsTableName', function() { -------------- next part -------------- HTML����������������������������... 다운로드