@@ -16,10 +16,10 @@ describe('DynamoDBStorage tests', () => {
1616 } ) ;
1717
1818 it ( 'Should get migrations' , async ( ) => {
19- const spy = jest . fn ( ( params : DocumentClient . QueryInput , callback : Function ) => {
20- callback ( null , { Items : [ { executed : 'OK' , name : 'bar' } ] } ) ;
19+ const spy = jest . fn ( ( params : DocumentClient . ScanInput , callback : Function ) => {
20+ callback ( null , { Items : [ { name : 'bar' } ] } ) ;
2121 } ) ;
22- AWSMock . mock ( 'DynamoDB.DocumentClient' , 'query ' , spy ) ;
22+ AWSMock . mock ( 'DynamoDB.DocumentClient' , 'scan ' , spy ) ;
2323
2424 const migrations = await new DynamoDBStorage ( { } ) . executed ( ) ;
2525
@@ -31,13 +31,13 @@ describe('DynamoDBStorage tests', () => {
3131 } ) ;
3232
3333 it ( 'Should get paginated migrations' , async ( ) => {
34- const spy = jest . fn ( ( params : DocumentClient . QueryInput , callback : Function ) => {
34+ const spy = jest . fn ( ( params : DocumentClient . ScanInput , callback : Function ) => {
3535 callback ( null , params . ExclusiveStartKey
36- ? { Items : [ { executed : 'OK' , name : 'bar' } ] }
37- : { Items : [ { executed : 'OK' , name : 'foo' } ] , LastEvaluatedKey : { } }
36+ ? { Items : [ { name : 'bar' } ] }
37+ : { Items : [ { name : 'foo' } ] , LastEvaluatedKey : { } }
3838 ) ;
3939 } ) ;
40- AWSMock . mock ( 'DynamoDB.DocumentClient' , 'query ' , spy ) ;
40+ AWSMock . mock ( 'DynamoDB.DocumentClient' , 'scan ' , spy ) ;
4141
4242 const migrations = await new DynamoDBStorage ( { } ) . executed ( ) ;
4343
@@ -59,7 +59,7 @@ describe('DynamoDBStorage tests', () => {
5959 await new DynamoDBStorage ( { } ) . logMigration ( migrationName ) ;
6060
6161 expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
62- expect ( spy . mock . calls [ 0 ] [ 0 ] ) . toEqual ( { TableName : 'migrations' , Item : { name : migrationName , executed : 'OK' } } ) ;
62+ expect ( spy . mock . calls [ 0 ] [ 0 ] ) . toEqual ( { TableName : 'migrations' , Item : { name : migrationName } } ) ;
6363
6464 AWSMock . restore ( 'DynamoDB.DocumentClient' ) ;
6565 } ) ;
@@ -76,7 +76,7 @@ describe('DynamoDBStorage tests', () => {
7676 const migrationName = 'foo' ;
7777 await new DynamoDBStorage ( { timestamp : true } ) . logMigration ( migrationName ) ;
7878
79- const etalon = { TableName : 'migrations' , Item : { name : migrationName , executed : 'OK' , createdAt : now } } ;
79+ const etalon = { TableName : 'migrations' , Item : { name : migrationName , createdAt : now } } ;
8080 expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
8181 expect ( spy . mock . calls [ 0 ] [ 0 ] ) . toEqual ( etalon ) ;
8282
@@ -93,7 +93,7 @@ describe('DynamoDBStorage tests', () => {
9393 await new DynamoDBStorage ( { } ) . unlogMigration ( migrationName ) ;
9494
9595 expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
96- expect ( spy . mock . calls [ 0 ] [ 0 ] ) . toEqual ( { TableName : 'migrations' , Key : { name : migrationName , executed : 'OK' } } ) ;
96+ expect ( spy . mock . calls [ 0 ] [ 0 ] ) . toEqual ( { TableName : 'migrations' , Key : { name : migrationName } } ) ;
9797
9898 AWSMock . restore ( 'DynamoDB.DocumentClient' ) ;
9999 } ) ;
0 commit comments