Files
react-native-devtools-frontend/node_modules/comment-parser/tests/unit/transforms-indent.spec.ts
T
Simon Zünd aebbf4f106 [deps] Update 'eslint-plugin-jsdoc' to 46.10.1
This silences a warning because our Node engine is newer then the
package expects.

There are newer versions of the plugin by now, but the transitive
dependencies are younger than 1 week so the audit mirror blocks them.
46.10.1 seems like it was stable for a couple months so we use that.

R=alexrudenko@chromium.org

Bug: None
Change-Id: Icf1c1276852e55dcad97d2ea2eeb6a8d7a9d82ae
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5660063
Commit-Queue: Simon Zünd <szuend@chromium.org>
Auto-Submit: Simon Zünd <szuend@chromium.org>
Commit-Queue: Alex Rudenko <alexrudenko@chromium.org>
Reviewed-by: Alex Rudenko <alexrudenko@chromium.org>
2024-06-27 09:26:18 +00:00

96 lines
2.4 KiB
TypeScript

import indent from '../../src/transforms/indent.js';
import getParser from '../../src/parser/index.js';
import getStringifier from '../../src/stringifier/index.js';
test('push', () => {
const source = `
/**
* Description may go
* over multiple lines followed by @tags
*
* @my-tag {my.type} my-name description line 1
description line 2
* description line 3
*/`;
const expected = `
/**
* Description may go
* over multiple lines followed by @tags
*
* @my-tag {my.type} my-name description line 1
description line 2
* description line 3
*/`;
const parsed = getParser()(source);
const out = getStringifier()(indent(4)(parsed[0]));
expect(out).toBe(expected.slice(1));
});
test('pull', () => {
const source = `
/**
* Description may go
* over multiple lines followed by @tags
*
* @my-tag {my.type} my-name description line 1
description line 2
* description line 3
*/`;
const expected = `
/**
* Description may go
* over multiple lines followed by @tags
*
* @my-tag {my.type} my-name description line 1
description line 2
* description line 3
*/`;
const parsed = getParser()(source);
const out = getStringifier()(indent(2)(parsed[0]));
expect(out).toBe(expected.slice(1));
});
test('force pull', () => {
const source = `
/**
* Description may go
* over multiple lines followed by @tags
*
* @my-tag {my.type} my-name description line 1
description line 2
* description line 3
*/`;
const expected = `
/**
* Description may go
* over multiple lines followed by @tags
*
* @my-tag {my.type} my-name description line 1
description line 2
* description line 3
*/`;
const parsed = getParser()(source);
const indented = indent(0)(parsed[0]);
const out = getStringifier()(indented);
expect(out).toBe(expected.slice(1));
});
test('spec source referencing', () => {
const parsed = getParser()(`/** @tag {type} name Description */`);
const block = indent(0)(parsed[0]);
expect(block.tags[0].source[0] === block.source[0]).toBe(true);
});
test('block source clonning', () => {
const parsed = getParser()(`/** @tag {type} name Description */`);
const block = indent(0)(parsed[0]);
parsed[0].source[0].tokens.description = 'test';
expect(block.source[0].tokens.description).toBe('Description ');
});