11// tslint:disable:no-empty
2+ // tslint:disable:no-unnecessary-callback-wrapper
23
34import { Config , Credentials , DynamoDB } from 'aws-sdk'
45import { EMPTY , Observable } from 'rxjs'
@@ -7,8 +8,7 @@ import { DynamoRx } from './dynamo-rx'
78import { SessionValidityEnsurer } from './session-validity-ensurer.type'
89
910describe ( 'dynamo rx' , ( ) => {
10-
11-
11+
1212 describe ( 'should call the validity ensurer before each call and return an observable' , ( ) => {
1313 let dynamoRx : DynamoRx
1414 let spyValidityEnsurer : SessionValidityEnsurer
@@ -60,6 +60,16 @@ describe('dynamo rx', () => {
6060 } )
6161 } )
6262
63+ it ( 'should call makeRequest with the given params' , async ( ) => {
64+ const dynamoRx = new DynamoRx ( DEFAULT_SESSION_VALIDITY_ENSURER )
65+ const makeRequest = jasmine . createSpy ( ) . and . returnValue ( { promise : ( ) => Promise . resolve ( null ) } )
66+ Object . assign ( dynamoRx , { dynamoDb : { makeRequest } } )
67+
68+ await dynamoRx . makeRequest ( < any > { ok : true } ) . toPromise ( )
69+ expect ( makeRequest ) . toHaveBeenCalled ( )
70+ expect ( makeRequest . calls . mostRecent ( ) . args [ 0 ] ) . toEqual ( { ok : true } )
71+ } )
72+
6373 it ( 'should update the credentials' , ( ) => {
6474 const dynamoRx = new DynamoRx ( DEFAULT_SESSION_VALIDITY_ENSURER )
6575 const credentials = new Credentials ( { secretAccessKey : '' , sessionToken : '' , accessKeyId : '' } )
0 commit comments