@@ -19,6 +19,10 @@ describe('getSuggestions', () => {
19
19
{
20
20
id : 'Kernel' ,
21
21
title : 'Kernel' ,
22
+ sections : [
23
+ { id : 'The standard library' , anchor : 'module-the-standard-library' } ,
24
+ { id : 'Guards' , anchor : 'module-guards' }
25
+ ] ,
22
26
nodeGroups : [
23
27
{
24
28
key : 'functions' ,
@@ -54,7 +58,20 @@ describe('getSuggestions', () => {
54
58
}
55
59
] ,
56
60
tasks : [ { id : 'phx.server' , title : 'phx.server' } ] ,
57
- extras : [ { id : 'api-reference' , title : 'API Reference' } ]
61
+ extras : [
62
+ {
63
+ id : 'api-reference' ,
64
+ title : 'API Reference'
65
+ } ,
66
+ {
67
+ id : 'library-guidelines' ,
68
+ title : 'Library Guidelines' ,
69
+ headers : [
70
+ { id : 'Getting started' , anchor : 'getting-started' } ,
71
+ { id : 'Publishing' , anchor : 'publishing' }
72
+ ]
73
+ }
74
+ ]
58
75
}
59
76
} )
60
77
@@ -67,6 +84,11 @@ describe('getSuggestions', () => {
67
84
expect ( getSuggestions ( 'My exception' ) . length ) . to . eql ( 1 )
68
85
} )
69
86
87
+ it ( 'returns matching sections of modules and extras' , ( ) => {
88
+ expect ( getSuggestions ( 'Getting' ) . length ) . to . eql ( 1 )
89
+ expect ( getSuggestions ( 'Gua' ) . length ) . to . eql ( 1 )
90
+ } )
91
+
70
92
it ( 'returns matching functions, callbacks and types' , ( ) => {
71
93
expect ( getSuggestions ( 'get_by' ) . length ) . to . eql ( 1 )
72
94
expect ( getSuggestions ( 'fetch' ) . length ) . to . eql ( 1 )
@@ -110,7 +132,7 @@ describe('getSuggestions', () => {
110
132
} )
111
133
112
134
it ( 'sorts results, putting closer matches at the top' , ( ) => {
113
- let results = getSuggestions ( 'insert' )
135
+ const results = getSuggestions ( 'insert' )
114
136
expect ( results [ 0 ] . title ) . to . eql ( '<em>insert</em>/2' )
115
137
expect ( results [ 1 ] . title ) . to . eql ( '<em>insert</em>_all/3' )
116
138
} )
0 commit comments