diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-23 12:48:46 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-05-23 12:48:46 +0200 |
commit | b856bff91b843585b653351c70941865cfe576a3 (patch) | |
tree | dc54746b90ac31f68494ecee4c256eeb328a8c2d /lib/constants | |
parent | 0744f000f9a0274279397a1a6635e4d7bbb9e718 (diff) | |
download | gitbook-b856bff91b843585b653351c70941865cfe576a3.zip gitbook-b856bff91b843585b653351c70941865cfe576a3.tar.gz gitbook-b856bff91b843585b653351c70941865cfe576a3.tar.bz2 |
Add failing test for #1316
Diffstat (limited to 'lib/constants')
-rw-r--r-- | lib/constants/__tests__/configSchema.js | 26 | ||||
-rw-r--r-- | lib/constants/configSchema.js | 10 |
2 files changed, 32 insertions, 4 deletions
diff --git a/lib/constants/__tests__/configSchema.js b/lib/constants/__tests__/configSchema.js new file mode 100644 index 0000000..546ec82 --- /dev/null +++ b/lib/constants/__tests__/configSchema.js @@ -0,0 +1,26 @@ +var jsonschema = require('jsonschema'); +var schema = require('../configSchema'); + +describe('configSchema', function() { + + function validate(cfg) { + var v = new jsonschema.Validator(); + return v.validate(cfg, schema, { + propertyName: 'config' + }); + } + + describe('structure', function() { + + it('should accept dot in filename', function() { + var result = validate({ + structure: { + readme: 'book-intro.adoc' + } + }); + + expect(result.errors.length).toBe(0); + }); + + }); +}); diff --git a/lib/constants/configSchema.js b/lib/constants/configSchema.js index 3fb2050..b9de04a 100644 --- a/lib/constants/configSchema.js +++ b/lib/constants/configSchema.js @@ -1,3 +1,5 @@ +var FILENAME_REGEX = '^[0-9a-zA-Z ... ]+$'; + module.exports = { '$schema': 'http://json-schema.org/schema#', 'id': 'https://gitbook.com/schemas/book.json', @@ -57,25 +59,25 @@ module.exports = { 'default': 'LANGS.md', 'type': 'string', 'title': 'File to use as languages index', - 'pattern': '^[0-9a-zA-Z ... ]+$' + 'pattern': FILENAME_REGEX }, 'readme': { 'default': 'README.md', 'type': 'string', 'title': 'File to use as preface', - 'pattern': '^[0-9a-zA-Z ... ]+$' + 'pattern': FILENAME_REGEX }, 'glossary': { 'default': 'GLOSSARY.md', 'type': 'string', 'title': 'File to use as glossary index', - 'pattern': '^[0-9a-zA-Z ... ]+$' + 'pattern': FILENAME_REGEX }, 'summary': { 'default': 'SUMMARY.md', 'type': 'string', 'title': 'File to use as table of contents', - 'pattern': '^[0-9a-zA-Z ... ]+$' + 'pattern': FILENAME_REGEX } }, 'additionalProperties': false |