Skip to content

Commit

Permalink
fix: remove filenames in typescript symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
bafolts committed Sep 26, 2023
1 parent dcbf558 commit 9c5e260
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Factories/ComponentFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export function getHeritageClauseNames(heritageClause: ts.HeritageClause, checke
const symbolAtLocation: ts.Symbol | undefined = checker.getSymbolAtLocation(nodeObject.expression);
if (symbolAtLocation !== undefined) {
const ogFile: string = getOriginalFile(symbolAtLocation, checker);

return [checker.getFullyQualifiedName(symbolAtLocation), ogFile];
let qualifiedName = checker.getFullyQualifiedName(symbolAtLocation);
qualifiedName = qualifiedName.replace(/"[^"]+"\./, "");
return [qualifiedName, ogFile];
}

return ['', ''];
Expand Down
21 changes: 21 additions & 0 deletions test/playground.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,27 @@ describe('Parse Playground codes', () => {
'@enduml'].join(os.EOL));
});

it('generate PlantUML in same file', () => {
expect(tplant.convertToPlant(tplant.generateDocumentation(`
export interface Foo {
bar: number;
foo: string;
}
export interface Bar extends Foo {
foobar: boolean;
}
`))).toEqual(
['@startuml',
'interface Foo {',
' +bar: number',
' +foo: string',
'}',
'interface Bar extends Foo {',
' +foobar: boolean',
'}',
'@enduml'].join(os.EOL));
});

it('generate PlantUML for Generics/RecursiveGenericType.ts', () => {
expect(tplant.convertToPlant(tplant.generateDocumentation(['test/Playground/Generics/RecursiveGenericType.ts'])))
.toEqual(
Expand Down

0 comments on commit 9c5e260

Please sign in to comment.