Skip to content

Commit 623783b

Browse files
author
WangQianliang
authored
fix(code/frontend): should match exactly the container name (elastic#39046) (elastic#39144)
1 parent 56c8c2e commit 623783b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Diff for: x-pack/plugins/code/public/reducers/__tests__/match_container_name.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import { matchContainerName } from '../../utils/symbol_utils';
88

99
describe('matchSymbolName', () => {
10+
it('should match symbol whose name is exactly the container name', () => {
11+
expect(matchContainerName('Session', 'Session')).toBe(true);
12+
});
1013
it('should match symbol that has type annotation', () => {
1114
expect(matchContainerName('Session', 'Session<key, value>')).toBe(true);
1215
});

Diff for: x-pack/plugins/code/public/utils/symbol_utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66

77
export const matchContainerName = (containerName: string, symbolName: string) =>
8-
new RegExp(`^${containerName}[[<(].*[>)]]?$`).test(symbolName);
8+
new RegExp(`^${containerName}([<(].*[>)])?$`).test(symbolName);

0 commit comments

Comments
 (0)