Remove tests duplicate

This commit is contained in:
patrick.lafrance 2019-11-12 20:18:56 -05:00
parent 796d1fd0a3
commit 240075b44a

View File

@ -224,21 +224,7 @@
// expect(propDef.description).toBe('');
// });
// describe('when the description contains a @param tag', () => {
// it('should have func as type when it is an invalid @param tag', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('func');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have a func signature with a single arg as type when it is a @param tag with a name', () => {
// it('should have a func signature when there is a @param tag', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param event',
@ -251,278 +237,7 @@
// expect(propDef.description).toBe('onClick description');
// });
// it('should have a func signature with a single arg as type when it is a @param tag with a name and a type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {SyntheticEvent} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have a func signature with a single arg as type when it is a @param tag with a name, a type and a desc', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event - Original SyntheticEvent',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have func as type when it is @param tag without a name 1', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param - Original SyntheticEvent',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('func');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have func as type when it is @param tag without a name 2', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {SyntheticEvent} - Original SyntheticEvent',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('func');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param of record type with a single field', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {{a: number}} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: ({a: number}))');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param of record type with multiple fields', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {{a: number, b: string}} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: ({a: number, b: string}))');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param of record type with a field having only a name', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {{a}} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: ({a}))');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param of union type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {(number|boolean)} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: (number|boolean))');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param of array type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {number[]} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: number[])');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param of untyped array type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {[]} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: [])');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param with a nullable type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {?number} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: number)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param with a non nullable type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {!number} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: number)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support optional param 1', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {number} [event]',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: number)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support optional param 2', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {number=} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: number)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support param of type any', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {*} event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: any)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support multilines description when there is a @param', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\nis a\nmulti-lines\ndescription\n@param event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event)');
// expect(propDef.description).toBe('onClick description\nis a\nmulti-lines\ndescription');
// });
// it('should support multilines @param description', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param event - This is my param\nmultiline description\n@param customData',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event, customData)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should autofix missing space between the param name and the description separator', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event- Original SyntheticEvent',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should autofix param name ending with . followed by a @returns tag', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param {SyntheticEvent} event.\n',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should provide raw @param tags', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event - Original event.\n@param {string} value',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.description).toBe('onClick description');
// expect(propDef.jsDocTags).toBeDefined();
// expect(propDef.jsDocTags.params).toBeDefined();
// expect(propDef.jsDocTags.params[0].name).toBe('event');
// expect(propDef.jsDocTags.params[0].description).toBe('Original event.');
// expect(propDef.jsDocTags.params[1].name).toBe('value');
// expect(propDef.jsDocTags.params[1].description).toBeNull();
// });
// });
// describe('when the description contains multiple @param tags', () => {
// it('should have a func signature with multiple args as type', () => {
// it('should have a func signature with multiple args when there is multiple @param tags', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
@ -536,62 +251,7 @@
// expect(propDef.description).toBe('onClick description');
// });
// it('should ignore invalid @param tags', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event\n@param {string} customData\n@param {SyntheticEvent} - Original event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent, customData: string)');
// expect(propDef.description).toBe('onClick description');
// });
// });
// it('should support @arg alias', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@arg event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support @argument alias', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@argument event',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event)');
// expect(propDef.description).toBe('onClick description');
// });
// describe('when the description contains a @returns tag', () => {
// it('should have func as type when it is an invalid @returns tag', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('func');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have a func signature with a return type as type when it is a @returns tag with a type', () => {
// it('should have a func signature with a return type when there is a @returns tag', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {string}',
@ -604,46 +264,7 @@
// expect(propDef.description).toBe('onClick description');
// });
// it('should have a func signature with a return type as type when it is a @returns tag with a type and a description', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {string} - A custom return type',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('() => string');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have func as type when it is a @returns tag without a type and there is no params.', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns - A custom return type',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('func');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have no return type when it is a @returns tag without a type and there is params.', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@param event\n@returns - A custom return type',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have a full signature as type when there is a @param and a @returns tag 1', () => {
// it('should have a full signature when there is a @param and a @returns tag', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
@ -656,158 +277,5 @@
// expect(propDef.type).toBe('(event: SyntheticEvent) => string');
// expect(propDef.description).toBe('onClick description');
// });
// it('should have a full signature as type when there is a @param and a @returns tag 2', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event - Original event.\n@param {string} customData\n@returns {string}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent, customData: string) => string');
// expect(propDef.description).toBe('onClick description');
// });
// it('should only consider the last @returns tag when there is more than one', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {string}\n@returns {integer}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('() => integer');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support returns of record type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {{a: number, b: string}}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('() => ({a: number, b: string})');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support returns of array type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {integer[]}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('() => integer[]');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support returns of union type', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {(number|boolean)}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('() => (number|boolean)');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support returns of type any', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {*}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('() => any');
// expect(propDef.description).toBe('onClick description');
// });
// it('should support returns of type void', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description: 'onClick description\n@returns {void}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('() => void');
// expect(propDef.description).toBe('onClick description');
// });
// it('should provide raw @returns tags when a description is defined', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event - Original event.\n@returns {string} - An awesome string.',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.description).toBe('onClick description');
// expect(propDef.jsDocTags).toBeDefined();
// expect(propDef.jsDocTags.returns).toBeDefined();
// expect(propDef.jsDocTags.returns.description).toBe('An awesome string.');
// });
// it('should provide raw @returns tags when there is no description', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event - Original event.\n@returns {string}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.description).toBe('onClick description');
// expect(propDef.jsDocTags).toBeDefined();
// expect(propDef.jsDocTags.returns).toBeDefined();
// expect(propDef.jsDocTags.returns.description).toBeNull();
// });
// });
// it('should remove extra newline characters between tags', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event - Original event.\n \n \n \n@returns {string}',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent) => string');
// expect(propDef.description).toBe('onClick description');
// });
// it('should ignore unsupported JSDoc tags', () => {
// const docgenInfo = createDocgenInfo({
// ...createType('func'),
// description:
// 'onClick description\n@param {SyntheticEvent} event\n@type {number}\n@returns {string}\n@version 2',
// });
// const extractedProp = extractProp(PROP_NAME, docgenInfo, javaScriptFactory);
// const propDef = enhancePropTypesProp(extractedProp);
// expect(propDef.type).toBe('(event: SyntheticEvent) => string');
// expect(propDef.description).toBe('onClick description');
// });
// });
// });