11import expect from 'expect' ;
2- import { getSuggestion , evalAllProperties } from '../src/components/suggestionBuilder' ;
2+ import { getSuggestions , evalAllProperties } from '../src/components/suggestionBuilder' ;
33
44
55describe ( 'get suggestion' , ( ) => {
66 it ( 'should lists . suggestions' , ( ) => {
77 // Given
88 // When
9- const suggestion = getSuggestion ( '$.' , 2 , { test : 0 } ) ;
9+ const suggestion = getSuggestions ( '$.' , 2 , { test : 0 } ) ;
1010 // Then
1111 expect ( suggestion ) . toEqual ( [
1212 { value : 'test' , description : 'property' , scopes : [ 'object' ] } ,
@@ -15,25 +15,25 @@ describe('get suggestion', () => {
1515 value : '*' ,
1616 scopes : [ '[]' , '.' ]
1717 }
18- ] )
19- } )
18+ ] ) ;
19+ } ) ;
2020
2121 it ( 'should lists .. suggestions' , ( ) => {
2222 // Given
2323 // When
24- const suggestion = getSuggestion ( '$..' , 2 , { test : 0 , test2 : [ { test3 : 1 } ] } ) ;
24+ const suggestion = getSuggestions ( '$..' , 2 , { test : 0 , test2 : [ { test3 : 1 } ] } ) ;
2525 // Then
2626 expect ( suggestion ) . toEqual ( [
2727 { value : 'test' , description : 'property' , scopes : [ 'object' ] } ,
2828 { value : 'test2' , description : 'property' , scopes : [ 'object' ] } ,
2929 { value : 'test3' , description : 'property' , scopes : [ 'object' ] }
30- ] )
31- } )
30+ ] ) ;
31+ } ) ;
3232
3333 it ( 'should lists object suggestions' , ( ) => {
3434 // Given
3535 // When
36- const suggestion = getSuggestion ( '$' , 2 , { test : 0 } ) ;
36+ const suggestion = getSuggestions ( '$' , 2 , { test : 0 } ) ;
3737 // Then
3838 expect ( suggestion ) . toEqual ( [
3939 {
@@ -57,13 +57,13 @@ describe('get suggestion', () => {
5757 value : '.*' ,
5858 scopes : [ 'array' , 'object' ]
5959 } ,
60- ] )
61- } )
60+ ] ) ;
61+ } ) ;
6262
6363 it ( 'should lists array suggestions' , ( ) => {
6464 // Given
6565 // When
66- const suggestion = getSuggestion ( '$' , 2 , [ 0 , 1 ] ) ;
66+ const suggestion = getSuggestions ( '$' , 2 , [ 0 , 1 ] ) ;
6767 // Then
6868 expect ( suggestion ) . toEqual ( [
6969 {
@@ -102,13 +102,13 @@ describe('get suggestion', () => {
102102 value : '.*' ,
103103 scopes : [ 'array' , 'object' ]
104104 } ,
105- ] )
106- } )
105+ ] ) ;
106+ } ) ;
107107
108108 it ( 'should lists pick suggestions' , ( ) => {
109109 // Given
110110 // When
111- const suggestion = getSuggestion ( '$.test[]' , 6 , { test : [ 0 , 1 ] } ) ;
111+ const suggestion = getSuggestions ( '$.test[]' , 7 , { test : [ 0 , 1 ] } ) ;
112112 // Then
113113 expect ( suggestion ) . toEqual ( [
114114 {
@@ -139,31 +139,31 @@ describe('get suggestion', () => {
139139 value : '*' ,
140140 scopes : [ '[]' , '.' ]
141141 }
142- ] )
143- } )
142+ ] ) ;
143+ } ) ;
144144
145145 it ( 'should not lists pick suggestions' , ( ) => {
146146 // Given
147147 // When
148- const suggestion = getSuggestion ( '$.test[]' , 7 , { test : [ 0 , 1 ] } ) ;
148+ const suggestion = getSuggestions ( '$.test[]' , 8 , { test : [ 0 , 1 ] } ) ;
149149 // Then
150- expect ( suggestion ) . toEqual ( [ ] )
151- } )
150+ expect ( suggestion ) . toEqual ( [ ] ) ;
151+ } ) ;
152152
153153 it ( 'should lists no suggestions when json path is invalid' , ( ) => {
154154 // Given
155155 // When
156- const suggestion = getSuggestion ( '$.hello[@' , 1 , { test : [ 0 , 1 ] } ) ;
156+ const suggestion = getSuggestions ( '$.hello[@' , 1 , { test : [ 0 , 1 ] } ) ;
157157 // then
158158 expect ( suggestion ) . toEqual ( [ ] ) ;
159- } )
159+ } ) ;
160160
161161 it ( 'should lists no properties when json path is invalid' , ( ) => {
162162 // Given
163163 const suggestions = [ { value : 'all_properties' , description : 'test' } , { value : 'all_properties_recursively' , description : 'test' } ] ;
164164 // When
165165 const evaluatedProperties = evalAllProperties ( suggestions , '$....' , { test : 'a' } ) ;
166166 // Then
167- expect ( evaluatedProperties ) . toEqual ( [ [ ] , [ ] ] )
168- } )
169- } )
167+ expect ( evaluatedProperties ) . toEqual ( [ [ ] , [ ] ] ) ;
168+ } ) ;
169+ } ) ;
0 commit comments