@@ -62,14 +62,41 @@ describe('makeIndexSpec()', () => {
62
62
name : 'sample_index1_-1_sample_index2_1_sample_index3_2d'
63
63
} ,
64
64
{
65
- description : 'mixed array of [string, [string, IndexDirection], { [key: string]: IndexDirection }]' ,
66
- input : [ 'sample_index1' , [ 'sample_index2' , - 1 ] , { sample_index3 : '2d' } ] ,
65
+ description :
66
+ 'mixed array of [string, [string, IndexDirection], { [key: string]: IndexDirection }, Map<string, IndexDirection>]' ,
67
+ input : [
68
+ 'sample_index1' ,
69
+ [ 'sample_index2' , - 1 ] ,
70
+ { sample_index3 : '2d' } ,
71
+ new Map < string , IndexDirection > ( [ [ 'sample_index4' , '2dsphere' ] ] )
72
+ ] ,
73
+ mapData : new Map < string , IndexDirection > ( [
74
+ [ 'sample_index1' , 1 ] ,
75
+ [ 'sample_index2' , - 1 ] ,
76
+ [ 'sample_index3' , '2d' ] ,
77
+ [ 'sample_index4' , '2dsphere' ]
78
+ ] ) ,
79
+ name : 'sample_index1_1_sample_index2_-1_sample_index3_2d_sample_index4_2dsphere'
80
+ } ,
81
+ {
82
+ description : 'array of Map<string, IndexDirection>' ,
83
+ input : [
84
+ new Map < string , IndexDirection > ( [ [ 'sample_index1' , 1 ] ] ) ,
85
+ new Map < string , IndexDirection > ( [ [ 'sample_index2' , - 1 ] ] ) ,
86
+ new Map < string , IndexDirection > ( [ [ 'sample_index3' , '2d' ] ] )
87
+ ] ,
67
88
mapData : new Map < string , IndexDirection > ( [
68
89
[ 'sample_index1' , 1 ] ,
69
90
[ 'sample_index2' , - 1 ] ,
70
91
[ 'sample_index3' , '2d' ]
71
92
] ) ,
72
93
name : 'sample_index1_1_sample_index2_-1_sample_index3_2d'
94
+ } ,
95
+ {
96
+ description : 'single Map<string, IndexDirection>' ,
97
+ input : new Map < string , IndexDirection > ( [ [ 'sample_index' , - 1 ] ] ) ,
98
+ mapData : new Map < string , IndexDirection > ( [ [ 'sample_index' , - 1 ] ] ) ,
99
+ name : 'sample_index_-1'
73
100
}
74
101
] ;
75
102
@@ -82,7 +109,7 @@ describe('makeIndexSpec()', () => {
82
109
expect ( realOutput . indexes [ 0 ] . key ) . to . deep . equal ( mapData ) ;
83
110
} ) ;
84
111
85
- it ( `should set name to null if none provided with ${ description } input ` , ( ) => {
112
+ it ( `should set name correctly if none provided with ${ description } input ` , ( ) => {
86
113
const realOutput = makeIndexOperation ( input ) ;
87
114
expect ( realOutput . indexes [ 0 ] . name ) . to . equal ( name ) ;
88
115
} ) ;
0 commit comments