Comparing version 0.0.0 to 0.0.1
@@ -5,3 +5,3 @@ const rootSchema = require('./rootSchema'); | ||
// todo figure out how to get path to project root | ||
// console.log(JSON.stringify(rootSchema.describe(), null, 2)); | ||
@@ -8,0 +8,0 @@ // const schema = joi |
{ | ||
"name": "joi-md-doc", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/jacobworrel/joi-doc-gen.git" | ||
"url": "git+https://github.com/jacobworrel/joi-md-doc.git" | ||
}, | ||
@@ -21,5 +21,5 @@ "author": "Jacob Worrel", | ||
"bugs": { | ||
"url": "https://github.com/jacobworrel/joi-doc-gen/issues" | ||
"url": "https://github.com/jacobworrel/joi-md-doc/issues" | ||
}, | ||
"homepage": "https://github.com/jacobworrel/joi-doc-gen#readme", | ||
"homepage": "https://github.com/jacobworrel/joi-md-doc#readme", | ||
"dependencies": { | ||
@@ -26,0 +26,0 @@ "json2md": "^1.6.5", |
@@ -15,3 +15,3 @@ # joi-md-doc | ||
const joi = require('@hapi/joi'); | ||
const { makeMarkdownDoc } = require('joi-doc-gen'); | ||
const { makeMarkdownDoc } = require('joi-md-doc'); | ||
@@ -18,0 +18,0 @@ const schema = joi |
@@ -5,6 +5,6 @@ const R = require('ramda'); | ||
const maxValueListLength = 5; | ||
const ju = {}; | ||
ju.maxValueListLength = 5; | ||
ju.throwWhenNil = msg => | ||
@@ -82,8 +82,9 @@ R.when( | ||
R.defaultTo([]), | ||
R.when( | ||
R.ifElse( | ||
R.both( | ||
R.pipe(R.length, R.lte(R.__, maxValueListLength)), | ||
R.pipe(R.length, R.lte(R.__, ju.maxValueListLength)), | ||
R.complement(R.isEmpty), | ||
), | ||
R.pipe(ju.makeValueList, R.concat(`${label}: `), mdu.makeParagraph, R.of), | ||
R.always([]), | ||
), | ||
@@ -90,0 +91,0 @@ ), |
const joi = require('@hapi/joi'); | ||
const makeMarkdownByFilename = require('./makeMarkdownByFilename'); | ||
const R = require('ramda'); | ||
@@ -166,2 +167,18 @@ describe(`makeMarkdownByFilename`, () => { | ||
it(`should not show whitelist when list length >= maxValueListLength`, () => { | ||
const joiSchema = { | ||
describe: () => ({ | ||
metas: [{ name: 'Test', filename: 'test' }], | ||
keys: { | ||
foo: { | ||
type: 'string', | ||
allow: R.range(0, 100), | ||
}, | ||
}, | ||
}), | ||
}; | ||
expect(makeMarkdownByFilename(joiSchema)).toMatchSnapshot(); | ||
}); | ||
it(`should support blacklisting invalid values`, () => { | ||
@@ -183,2 +200,18 @@ const joiSchema = { | ||
it(`should not show blacklist when list length >= maxValueListLength`, () => { | ||
const joiSchema = { | ||
describe: () => ({ | ||
metas: [{ name: 'Test', filename: 'test' }], | ||
keys: { | ||
foo: { | ||
type: 'string', | ||
invalid: R.range(0, 100), | ||
}, | ||
}, | ||
}), | ||
}; | ||
expect(makeMarkdownByFilename(joiSchema)).toMatchSnapshot(); | ||
}); | ||
it(`should support min and max`, () => { | ||
@@ -185,0 +218,0 @@ const joiSchema = { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24448
651