@@ -3,54 +3,60 @@ var api = require('../dist/main');
33var grid = path . join ( __dirname , './components/grid/Grid.vue' ) ;
44var button = path . join ( __dirname , './components/button/Button.vue' ) ;
55const expect = require ( "chai" ) . expect ;
6+ let docGrid ;
7+ let docButton ;
68
7- describe ( 'tests' , ( ) => {
8- it ( 'should not return error' , ( ) => {
9- expect ( ( ) => { api . parse ( grid ) } ) . to . not . throw ( )
10- expect ( ( ) => { api . parse ( button ) } ) . to . not . throw ( )
9+ describe ( 'tests components' , ( ) => {
10+ docGrid = api . parse ( grid ) ;
11+ docButton = api . parse ( button ) ;
12+ console . log ( JSON . stringify ( docButton , null , 2 ) ) ;
13+
14+ it ( 'should return an object' , ( ) => {
15+ expect ( docGrid ) . to . be . an ( 'object' )
16+ expect ( docButton ) . to . be . an ( 'object' )
1117 } )
1218
13- const docJson = api . parse ( grid ) ;
14- const docButtonJson = api . parse ( button ) ;
15- console . log ( JSON . stringify ( docButtonJson , null , 2 ) ) ;
19+ it ( 'The component name should be buttonComponent' , ( ) => {
20+ expect ( docButton . displayName ) . to . equal ( 'buttonComponent' ) ;
21+ } )
1622
17- it ( 'should return an object ' , ( ) => {
18- expect ( docJson ) . to . be . an ( 'object' )
23+ it ( 'The component name should be grid ' , ( ) => {
24+ expect ( docGrid . displayName ) . to . equal ( 'grid' ) ;
1925 } )
2026
2127 it ( 'should the component have tags' , ( ) => {
22- expect ( typeof docJson [ 'tags' ] !== 'undefined' ) . to . be . true
28+ expect ( typeof docGrid [ 'tags' ] !== 'undefined' ) . to . be . true
2329 } )
2430
2531 it ( 'should the component have authors' , ( ) => {
26- expect ( typeof docJson [ 'tags' ] [ 'author' ] !== 'undefined' ) . to . be . true
32+ expect ( typeof docGrid [ 'tags' ] [ 'author' ] !== 'undefined' ) . to . be . true
2733 } )
2834
2935 it ( 'should the component have description' , ( ) => {
30- expect ( typeof docJson [ 'description' ] !== 'undefined' ) . to . be . true
36+ expect ( typeof docGrid [ 'description' ] !== 'undefined' ) . to . be . true
3137 } )
3238
3339 it ( 'should have methods' , ( ) => {
34- expect ( typeof docJson [ 'methods' ] !== 'undefined' ) . to . be . true
40+ expect ( typeof docGrid [ 'methods' ] !== 'undefined' ) . to . be . true
3541 } )
3642
3743 it ( 'should the component have one method' , ( ) => {
38- expect ( Object . keys ( docJson [ 'methods' ] ) . length === 1 ) . to . be . true
44+ expect ( Object . keys ( docGrid [ 'methods' ] ) . length === 1 ) . to . be . true
3945 } )
4046
4147 it ( 'should have props' , ( ) => {
42- expect ( typeof docJson [ 'props' ] !== 'undefined' ) . to . be . true
48+ expect ( typeof docGrid [ 'props' ] !== 'undefined' ) . to . be . true
4349 } )
4450
4551 it ( 'should the component have version' , ( ) => {
46- expect ( typeof docJson [ 'tags' ] [ 'version' ] !== 'undefined' ) . to . be . true
52+ expect ( typeof docGrid [ 'tags' ] [ 'version' ] !== 'undefined' ) . to . be . true
4753 } )
4854
4955 it ( 'should the component have three prop' , ( ) => {
50- expect ( Object . keys ( docJson [ 'props' ] ) . length === 3 ) . to . be . true
56+ expect ( Object . keys ( docGrid [ 'props' ] ) . length === 3 ) . to . be . true
5157 } )
5258
5359 it ( 'should the prop msg have four tags' , ( ) => {
54- expect ( Object . keys ( docJson [ 'props' ] [ 'msg' ] [ 'tags' ] ) . length === 4 ) . to . be . true
60+ expect ( Object . keys ( docGrid [ 'props' ] [ 'msg' ] [ 'tags' ] ) . length === 4 ) . to . be . true
5561 } )
5662} )
0 commit comments