Skip to content

Commit

Permalink
Add test for undocumented declaration (no comments)
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Jan 24, 2019
1 parent 4cb78b8 commit bcf94b4
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const myDeclaration = function() {};

export default myDeclaration;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "ExportDefaultDeclaration",
"start": 38,
"end": 67,
"range": [
38,
67
],
"declaration": {
"type": "Identifier",
"start": 53,
"end": 66,
"range": [
53,
66
],
"name": "myDeclaration"
}
}
13 changes: 13 additions & 0 deletions packages/docgen/tests/test-get-intermediate-representation.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ const test = require( 'tape' );
*/
const getIntermediateRepresentation = require( '../src/get-intermediate-representation' );

test( 'IR - undocumented', function( t ) {
const token = fs.readFileSync(
path.join( __dirname, './fixtures/default-undocumented-nocomments.json' ),
'utf-8'
);
t.deepEqual( getIntermediateRepresentation( JSON.parse( token ) ), [ {
name: 'default',
description: 'Undocumented declaration.',
tags: [],
} ] );
t.end();
} );

test( 'IR - default (JSDoc in export statement)', function( t ) {
const tokenClassAnonymous = fs.readFileSync(
path.join( __dirname, './fixtures/default-class-anonymous.json' ),
Expand Down

0 comments on commit bcf94b4

Please sign in to comment.