|
| 1 | +var getVueDoc = require('../../../dist/utils/getVueDoc').default |
| 2 | +const expect = require('chai').expect |
| 3 | + |
| 4 | +describe('getVueDoc', () => { |
| 5 | + it('should return right comment for longname default', () => { |
| 6 | + const result = getVueDoc({ |
| 7 | + file: '', |
| 8 | + getDocJs: () => [ |
| 9 | + { |
| 10 | + description: 'Component description', |
| 11 | + longname: 'default' |
| 12 | + }, |
| 13 | + { |
| 14 | + description: 'Prop description', |
| 15 | + longname: 'default.props.prop' |
| 16 | + } |
| 17 | + ] |
| 18 | + }, {}) |
| 19 | + expect(result.description).to.equal('Component description') |
| 20 | + }) |
| 21 | + |
| 22 | + it('should return right comment for longname _default', () => { |
| 23 | + const result = getVueDoc({ |
| 24 | + file: '', |
| 25 | + getDocJs: () => [ |
| 26 | + { |
| 27 | + description: 'Component description', |
| 28 | + longname: '_default' |
| 29 | + }, |
| 30 | + { |
| 31 | + description: 'Prop description', |
| 32 | + longname: '_default.props.prop' |
| 33 | + } |
| 34 | + ] |
| 35 | + }, {}) |
| 36 | + expect(result.description).to.equal('Component description') |
| 37 | + }) |
| 38 | + |
| 39 | + it('should return right comment for longname default2', () => { |
| 40 | + const result = getVueDoc({ |
| 41 | + file: '', |
| 42 | + getDocJs: () => [ |
| 43 | + { |
| 44 | + description: 'Component description', |
| 45 | + longname: 'default2' |
| 46 | + }, |
| 47 | + { |
| 48 | + description: 'Prop description', |
| 49 | + longname: 'default2.props.prop' |
| 50 | + } |
| 51 | + ] |
| 52 | + }, {}) |
| 53 | + expect(result.description).to.equal('Component description') |
| 54 | + }) |
| 55 | + |
| 56 | + it('should return right comment for longname _default2', () => { |
| 57 | + const result = getVueDoc({ |
| 58 | + file: '', |
| 59 | + getDocJs: () => [ |
| 60 | + { |
| 61 | + description: 'Component description', |
| 62 | + longname: '_default2' |
| 63 | + }, |
| 64 | + { |
| 65 | + description: 'Prop description', |
| 66 | + longname: '_default2.props.prop' |
| 67 | + } |
| 68 | + ] |
| 69 | + }, {}) |
| 70 | + expect(result.description).to.equal('Component description') |
| 71 | + }) |
| 72 | +}) |
0 commit comments