fix(code/frontend): should match exactly the container name (#39046) (#39144)

This commit is contained in:
WangQianliang 2019-06-18 14:15:32 +08:00 committed by GitHub
parent 56c8c2ef24
commit 623783b731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -7,6 +7,9 @@
import { matchContainerName } from '../../utils/symbol_utils';
describe('matchSymbolName', () => {
it('should match symbol whose name is exactly the container name', () => {
expect(matchContainerName('Session', 'Session')).toBe(true);
});
it('should match symbol that has type annotation', () => {
expect(matchContainerName('Session', 'Session<key, value>')).toBe(true);
});

View file

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