Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "joi-md-doc", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,6 +10,2 @@ const json2md = require('json2md'); | ||
const makeMarkdownWith = R.curry((path, schema) => { | ||
const name = R.pipe( | ||
ju.findMeta('name'), | ||
ju.throwWhenNil('Required name meta tag not provided.'), | ||
)(schema); | ||
const filename = R.pipe( | ||
@@ -19,2 +15,3 @@ ju.findMeta('filename'), | ||
)(schema); | ||
const name = R.pipe(ju.findMeta('name'), R.defaultTo(filename))(schema); | ||
const nextPath = R.append({ name, filename }, path); | ||
@@ -21,0 +18,0 @@ |
@@ -304,6 +304,6 @@ const joi = require('@hapi/joi'); | ||
it(`negative: should throw when no name meta tag`, () => { | ||
it(`negative: should throw when no filename meta tag`, () => { | ||
const joiSchema = { | ||
describe: () => ({ | ||
metas: [{ filename: 'test' }], | ||
metas: [{ name: 'Test' }], | ||
}), | ||
@@ -313,16 +313,17 @@ }; | ||
expect(() => makeMarkdownByFilename(joiSchema)).toThrowError( | ||
'Required name meta tag not provided.', | ||
'Required filename meta tag not provided.', | ||
); | ||
}); | ||
it(`negative: should throw when no filename meta tag`, () => { | ||
it(`should default name to filename`, () => { | ||
const joiSchema = { | ||
describe: () => ({ | ||
metas: [{ name: 'Test' }], | ||
metas: [{ filename: 'test' }], | ||
keys: { | ||
foo: { type: 'number' }, | ||
}, | ||
}), | ||
}; | ||
expect(() => makeMarkdownByFilename(joiSchema)).toThrowError( | ||
'Required filename meta tag not provided.', | ||
); | ||
expect(makeMarkdownByFilename(joiSchema)).toMatchSnapshot(); | ||
}); | ||
@@ -329,0 +330,0 @@ }); |
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
24538
649