File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ import { expect , test } from "vitest" ;
2+ import { makeDeclarationUrl } from "./declaration-url" ;
3+
4+ test ( "declarationUrl" , ( ) => {
5+ const declarationUrl = makeDeclarationUrl ( [
6+ {
7+ kind : "variable" ,
8+ id : "foo" ,
9+ name : "foo" ,
10+ docs : [ ] ,
11+ file : "foo.ts" ,
12+ line : 123 ,
13+ signature : "const foo: Foo;" ,
14+ } ,
15+ {
16+ kind : "namespace" ,
17+ id : "bar" ,
18+ name : "bar" ,
19+ docs : [ ] ,
20+ file : "bar.ts" ,
21+ line : 456 ,
22+ signature : "" ,
23+ declarations : [
24+ {
25+ kind : "variable" ,
26+ id : "bar.qux" ,
27+ name : "qux" ,
28+ docs : [ ] ,
29+ file : "qux.ts" ,
30+ line : 789 ,
31+ signature : "const qux: Qux;" ,
32+ } ,
33+ ] ,
34+ } ,
35+ ] ) ;
36+ expect ( declarationUrl ( "Awaited" ) ) . toMatchInlineSnapshot (
37+ `"https://www.typescriptlang.org/docs/handbook/utility-types.html#awaitedtype"` ,
38+ ) ;
39+ expect ( declarationUrl ( "foo" ) ) . toMatchInlineSnapshot ( `"#foo"` ) ;
40+ expect ( declarationUrl ( "qux" ) ) . toMatchInlineSnapshot ( `"#bar.qux"` ) ;
41+ } ) ;
You can’t perform that action at this time.
0 commit comments