/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
packages/compiler-cli/test/ngtsc/doc_extraction/docs_private_spec.ts
73 строки
2 KB
Andrew Kushnir
refactor(compiler-cli): convert scripts within `packages/compiler-cli` to relative imports (#60625)
01 апр 2025, 14:57
01 апр 2025, 14:57
4f458a8
Код
Авторство
О чём код?
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.dev/license */ import {DocEntry} from '../../../src/ngtsc/docs/src/entities'; import {runInEachFileSystem} from '../../../src/ngtsc/file_system/testing'; import {NgtscTestEnvironment} from '../env'; runInEachFileSystem(() => { describe('ngtsc docs: @docsPrivate tag', () => { let env: NgtscTestEnvironment; beforeEach(() => { env = NgtscTestEnvironment.setup({}); env.tsconfig(); }); function test(input: string): DocEntry[] { env.write('index.ts', input); return env.driveDocsExtraction('index.ts'); } it('should omit constant annotated with `@docsPrivate`', () => { expect( test(` /** @docsPrivate <reason> */ export const bla = true; `), ).toEqual([]); }); it('should omit class annotated with `@docsPrivate`', () => { expect( test(` /** @docsPrivate <reason> */ export class Bla {} `), ).toEqual([]); }); it('should omit function annotated with `@docsPrivate`', () => { expect( test(` /** @docsPrivate <reason> */ export function bla() {}; `), ).toEqual([]); }); it('should omit interface annotated with `@docsPrivate`', () => { expect( test(` /** @docsPrivate <reason> */ export interface BlaFunction {} `), ).toEqual([]); }); it('should error if marked as private without reasoning', () => { expect(() => test(` /** @docsPrivate */ export interface BlaFunction {} `), ).toThrowError(/Entry "BlaFunction" is marked as "@docsPrivate" but without reasoning./); }); }); });