|
1 | 1 | import { describe, it } from 'mocha';
|
2 | 2 | import { expect } from 'chai';
|
3 |
| -import { withTempParser } from './utils'; |
| 3 | +import { withTempParser, withTempSkipParser } from './utils'; |
4 | 4 | import { ValueParserError } from '../src/parser/ValueParserError';
|
5 | 5 | import { BasicTypeValue, ValueTypeKind } from '../src/types';
|
6 | 6 |
|
@@ -122,4 +122,50 @@ describe('Parser', () => {
|
122 | 122 | expect(() => parser.parse()).to.throw(ValueParserError).with.property('message', 'it has multiple parameters');
|
123 | 123 | });
|
124 | 124 | });
|
| 125 | + |
| 126 | + it('Multiple parameters with skip flag', () => { |
| 127 | + const sourceCode = ` |
| 128 | + /** |
| 129 | + * @shouldExport true |
| 130 | + */ |
| 131 | + interface MockedInterface { |
| 132 | + /** |
| 133 | + * This documentation should be skipped |
| 134 | + */ |
| 135 | + multipleParamsMethod(foo: string, bar: number); |
| 136 | + /** |
| 137 | + * This is an example documentation for the member |
| 138 | + */ |
| 139 | + mockedMember: string; |
| 140 | + /** |
| 141 | + * This is an example documentation for the method |
| 142 | + */ |
| 143 | + mockedMethod(): void; |
| 144 | + } |
| 145 | + `; |
| 146 | + |
| 147 | + withTempSkipParser(sourceCode, (parser) => { |
| 148 | + const modules = parser.parse(); |
| 149 | + expect(modules).to.deep.equal([ |
| 150 | + { |
| 151 | + name: 'MockedInterface', |
| 152 | + exportedInterfaceBases: [], |
| 153 | + documentation: '', |
| 154 | + customTags: {}, |
| 155 | + members: [{ |
| 156 | + name: 'mockedMember', |
| 157 | + type: { kind: ValueTypeKind.basicType, value: BasicTypeValue.string }, |
| 158 | + documentation: 'This is an example documentation for the member', |
| 159 | + }], |
| 160 | + methods: [{ |
| 161 | + name: 'mockedMethod', |
| 162 | + parameters: [], |
| 163 | + returnType: null, |
| 164 | + isAsync: false, |
| 165 | + documentation: 'This is an example documentation for the method', |
| 166 | + }], |
| 167 | + }, |
| 168 | + ]); |
| 169 | + }, new Set(), true); |
| 170 | + }); |
125 | 171 | });
|
0 commit comments