@@ -28,14 +28,14 @@ describe("ensure-index", () => {
2828 mockCollection . indexExists . mockReturnValue ( false ) ;
2929 utils . getUserInput . mockReturnValue ( true ) ;
3030 const collection = 'whatever' ;
31- const expectedIndexObj = { jobId : 1 , accountId : 1 , time : 1 }
31+ const expectedIndexObj = { accountId : 1 , jobId : 1 , time : 1 }
3232
3333 //execute
3434 await utils . ensureIndex ( mockDatabase , collection ) ;
3535
3636 //check
3737 expect ( mockCollection . indexExists ) . toBeCalledTimes ( 1 ) ;
38- expect ( mockCollection . indexExists ) . toBeCalledWith ( "jobId_1_accountId_1_time_1 " ) ;
38+ expect ( mockCollection . indexExists ) . toBeCalledWith ( "accountId_1_jobId_1_time_1 " ) ;
3939 expect ( mockCollection . estimatedDocumentCount ) . toBeCalledTimes ( 1 ) ;
4040 expect ( utils . getUserInput ) . toBeCalledTimes ( 1 ) ;
4141 expect ( mockCollection . createIndex ) . toBeCalledTimes ( 1 ) ;
@@ -52,7 +52,7 @@ describe("ensure-index", () => {
5252
5353 //check
5454 expect ( mockCollection . indexExists ) . toBeCalledTimes ( 1 ) ;
55- expect ( mockCollection . indexExists ) . toBeCalledWith ( "jobId_1_accountId_1_time_1 " ) ;
55+ expect ( mockCollection . indexExists ) . toBeCalledWith ( "accountId_1_jobId_1_time_1 " ) ;
5656 expect ( mockCollection . estimatedDocumentCount ) . toBeCalledTimes ( 1 ) ;
5757 expect ( utils . getUserInput ) . toBeCalledTimes ( 1 ) ;
5858 expect ( mockCollection . createIndex ) . toBeCalledTimes ( 0 ) ;
@@ -67,7 +67,7 @@ describe("ensure-index", () => {
6767
6868 //check
6969 expect ( mockCollection . indexExists ) . toBeCalledTimes ( 1 ) ;
70- expect ( mockCollection . indexExists ) . toBeCalledWith ( "jobId_1_accountId_1_time_1 " ) ;
70+ expect ( mockCollection . indexExists ) . toBeCalledWith ( "accountId_1_jobId_1_time_1 " ) ;
7171 expect ( mockCollection . estimatedDocumentCount ) . toBeCalledTimes ( 0 ) ;
7272 expect ( utils . getUserInput ) . toBeCalledTimes ( 0 ) ;
7373 expect ( mockCollection . createIndex ) . toBeCalledTimes ( 0 ) ;
0 commit comments