Skip to content

Commit 12ce1f7

Browse files
test(shared): retain explicit decorator-shaped file mentions
1 parent 45dc8d8 commit 12ce1f7

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎packages/shared/src/composerInlineTokens.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,28 @@ describe("collectComposerInlineTokens", () => {
9494
expect(collectComposerInlineTokens("入力 @expo/ui を追加")).toEqual([]);
9595
});
9696

97+
it.each(["@foo(bar)", "@namespace.foo(bar)", "@_private()", "@$inject(service)"])(
98+
"keeps decorator call %s as plain text",
99+
(reference) => {
100+
expect(collectComposerInlineTokens(`${reference}\nclass Example {}`)).toEqual([]);
101+
},
102+
);
103+
104+
it.each(['@"foo(bar)"', "[foo(bar)](foo%28bar%29)"])(
105+
"keeps an explicit decorator-shaped file reference as a mention: %s",
106+
(reference) => {
107+
expect(collectComposerInlineTokens(`${reference} `)).toEqual([
108+
{
109+
type: "mention",
110+
value: "foo(bar)",
111+
source: reference,
112+
start: 0,
113+
end: reference.length,
114+
},
115+
]);
116+
},
117+
);
118+
97119
it("keeps bare non-scoped file paths as mentions", () => {
98120
expect(collectComposerInlineTokens("Inspect @README.md next")).toEqual([
99121
{

0 commit comments

Comments
 (0)