Commit 696e7613 authored by VectorW's avatar VectorW

Option category change to jsdoc and additional test for vertical align

parent 99b7af59
......@@ -284,19 +284,19 @@ module.exports = {
},
jsdocDescriptionWithDot: {
type: 'boolean',
category: 'Global',
category: 'jsdoc',
default: false,
description: 'Should dot be inserted at the end of description'
},
jsdocDescriptionTag: {
type: 'boolean',
category: 'Global',
category: 'jsdoc',
default: true,
description: 'Should description tag be used',
},
jsdocVerticalAlignment: {
type: 'boolean',
category: 'Global',
category: 'jsdoc',
default: false,
description: 'Should tags, types, names and description be aligned',
}
......
......@@ -160,7 +160,7 @@ test('Should not add TODO for return desc if it has undefined|null|void type', (
test('Should align align vartically param|property|return|throws if option set to true', () => {
test('Should align vartically param|property|return|throws if option set to true', () => {
const options = {
jsdocVerticalAlignment: true
}
......@@ -190,6 +190,52 @@ test('Should align align vartically param|property|return|throws if option set t
expect(Result2).toEqual(Expected2)
})
test('Should align vartically param|property|return|throws if option set to true, and amount of spaces is different than default', () => {
const options1 = {
jsdocVerticalAlignment: true,
jsdocSpaces: 2
}
const unformattedJsdoc = `/**
* @property {Object} unalginedProp unaligned property descriptin
* @param {String} unalginedParam unaligned param description
* @throws {CustomExceptio} unaligned throws description
* @returns {undefined}
*/`
const Result1 = subject(unformattedJsdoc, options1)
const Expected1 = `/**
* @property {Object} unalginedProp Unaligned property descriptin
* @throws {CustomExceptio} Unaligned throws description
* @param {String} unalginedParam Unaligned param description
* @return {undefined}
*/
`
const options2 = {
jsdocVerticalAlignment: true,
jsdocSpaces: 4
}
const Result2 = subject(`/**
* @property {Object} unalginedProp unaligned property descriptin
* @param {String} unalginedParam unaligned param description
* @throws {CustomExceptio} unaligned throws description
* @returns {String} unaligned returns description
*/`, options2)
const Expected2 = `/**
* @property {Object} unalginedProp Unaligned property
* descriptin
* @throws {CustomExceptio} Unaligned throws
* description
* @param {String} unalginedParam Unaligned param
* description
* @return {String} Unaligned returns
* description
*/
`
expect(Result1).toEqual(Expected1)
expect(Result2).toEqual(Expected2)
})
test('Should insert proper amount of spaces based on option', () => {
const options1 = {
jsdocSpaces: 2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment