mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-02 18:11:04 +08:00
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>
96 lines
2.4 KiB
TypeScript
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 ');
|
|
});
|