@microsoft/api-extractor
Version:
Validate, document, and review the exported API for a TypeScript library
34 lines (32 loc) • 1.53 kB
JavaScript
;
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
const TypeScriptHelpers_1 = require("../TypeScriptHelpers");
describe('TypeScriptHelpers tests', () => {
describe('splitStringWithRegEx()', () => {
it('simple case', () => {
expect(TypeScriptHelpers_1.default.splitStringWithRegEx('ABCDaFG', /A/gi))
.toEqual(['A', 'BCD', 'a', 'FG']);
});
it('empty match', () => {
expect(TypeScriptHelpers_1.default.splitStringWithRegEx('', /A/gi))
.toEqual([]);
});
});
describe('extractCommentContent()', () => {
it('multi-line comment', () => {
expect(TypeScriptHelpers_1.default.extractCommentContent('/**\n * this is\n * a test\n */\n'))
.toBe('this is\na test');
});
it('single-line comment', () => {
expect(TypeScriptHelpers_1.default.extractCommentContent('/** single line comment */'))
.toBe('single line comment');
});
it('degenerate comment', () => {
expect(TypeScriptHelpers_1.default.removeJsdocSequences(['/**', '* degenerate comment', 'star missing here', '* end of comment', '*/']))
.toBe('degenerate comment\nstar missing here\nend of comment');
});
});
});
//# sourceMappingURL=TypeScriptHelpers.test.js.map