test: add additional test for codeGenApi (#29844)

Addresses comments made by @gkalpak in #29820

PR Close #29844
This commit is contained in:
Ben Lesh 2019-04-11 11:01:01 -07:00 committed by Alex Rickabaugh
parent bd2ce9cd56
commit b2962db4cb
2 changed files with 39 additions and 2 deletions

View File

@ -75,7 +75,7 @@ export function ɵɵprojectionDef(selectors?: CssSelectorList[]): void {
* @param selectorIndex:
* - 0 when the selector is `*` (or unspecified as this is the default value),
* - 1 based index of the selector from the {@link projectionDef}
*
*
* @codeGenApi
*/
export function ɵɵprojection(

View File

@ -561,7 +561,7 @@ describe('unit test', () => {
{paramTags: {requireAtLeastOne: ['stable']}});
});
it('should require at least one of the requireOnOf tags', () => {
it('should require at least one of the requireAtLeastOne tags', () => {
const input = `
/** @experimental */
export declare class A {
@ -573,6 +573,43 @@ describe('unit test', () => {
'file.d.ts(3,7): error: Required jsdoc tags - One of the tags: "@stable", "@foo", "@bar" - must exist on `param`.',
{paramTags: {requireAtLeastOne: ['stable', 'foo', 'bar']}});
});
it('should allow with one of the requireAtLeastOne tags found', () => {
const input = `
/**
* @foo
* @bar
* @stable
*/
export declare class A {
}
/**
* @foo
*/
export declare const b: string;
/**
* @bar
*/
export declare var c: number;
/**
* @stable
*/
export declare function d(): void;
`;
const expected = `
export declare class A {
}
export declare const b: string;
export declare var c: number;
export declare function d(): void;
`;
check(
{'file.d.ts': input}, expected,
{exportTags: {requireAtLeastOne: ['stable', 'foo', 'bar']}});
});
});
function getMockHost(files: {[name: string]: string}): ts.CompilerHost {