22
33var test = require ( 'tap' ) . test ,
44 parse = require ( '../../lib/parsers/javascript' ) ,
5- hierarchy = require ( '../../lib/hierarchy' ) ,
6- inferName = require ( '../../lib/infer/name' ) ,
7- inferKind = require ( '../../lib/infer/kind' ) ,
8- inferMembership = require ( '../../lib/infer/membership' ) ;
5+ hierarchy = require ( '../../lib/hierarchy' ) ;
96
107function toComments ( fn , filename ) {
118 return parse ( {
@@ -15,68 +12,53 @@ function toComments(fn, filename) {
1512}
1613
1714function evaluate ( fn , callback ) {
18- return hierarchy ( toComments ( fn , callback )
19- . map ( inferName )
20- . map ( inferKind )
21- . map ( inferMembership ) ) ;
15+ return hierarchy ( toComments ( fn , callback ) ) ;
2216}
2317
2418test ( 'hierarchy' , function ( t ) {
2519 var result = evaluate ( function ( ) {
2620 /**
27- * Creates a new Klass
28- * @param {string } foo bar
21+ * @name Class
2922 * @class
3023 */
31- function Klass ( foo ) {
32- this . foo = foo ;
33- }
3424
3525 /**
36- * Get this Klass's foo
37- * @returns {Number } foo
26+ * @name getFoo
27+ * @memberof Class
28+ * @instance
3829 */
39- Klass . prototype . getFoo = function ( ) {
40- return this . foo ;
41- } ;
4230
4331 /**
44- * Decide whether an object is a Klass instance
45- *
46- * @param {Object } other bar
47- * @returns {boolean } whether the other thing is a Klass
32+ * @name isClass
33+ * @memberof Class
34+ * @static
4835 */
49- Klass . isClass = function ( other ) {
50- return other instanceof Klass ;
51- } ;
5236
5337 /**
54- * A magic number that identifies this Klass.
38+ * @name MAGIC_NUMBER
39+ * @memberof Class
40+ * @static
5541 */
56- Klass . MAGIC_NUMBER = 42 ;
5742
5843 /**
59- * Klass event
60- * @event event
61- * @memberof Klass
44+ * @name event
45+ * @memberof Class
46+ * @kind event
6247 */
63-
64- return Klass ;
6548 } ) ;
6649
6750 t . equal ( result . length , 1 ) ;
6851
6952 t . equal ( result [ 0 ] . members . static . length , 2 ) ;
70- t . deepEqual ( result [ 0 ] . members . static [ 0 ] . path , [ 'Klass ' , 'isClass' ] ) ;
53+ t . deepEqual ( result [ 0 ] . members . static [ 0 ] . path , [ 'Class ' , 'isClass' ] ) ;
7154
7255 t . equal ( result [ 0 ] . members . instance . length , 1 ) ;
73- t . deepEqual ( result [ 0 ] . members . instance [ 0 ] . path , [ 'Klass ' , 'getFoo' ] ) ;
56+ t . deepEqual ( result [ 0 ] . members . instance [ 0 ] . path , [ 'Class ' , 'getFoo' ] ) ;
7457
7558 t . equal ( result [ 0 ] . events . length , 1 ) ;
76- t . deepEqual ( result [ 0 ] . events [ 0 ] . path , [ 'Klass ' , 'event' ] ) ;
59+ t . deepEqual ( result [ 0 ] . events [ 0 ] . path , [ 'Class ' , 'event' ] ) ;
7760
7861 t . end ( ) ;
79-
8062} ) ;
8163
8264test ( 'hierarchy - missing memberof' , function ( t ) {
@@ -86,11 +68,6 @@ test('hierarchy - missing memberof', function (t) {
8668 * @memberof DoesNotExist
8769 * @returns {Number } foo
8870 */
89- function getFoo ( ) {
90- return this . foo ;
91- }
92-
93- getFoo ( ) ;
9471 } ) ;
9572
9673 t . equal ( result . length , 1 ) ;
0 commit comments