Skip to content

Commit 5826b7f

Browse files
committed
test(dynamo-rx): add test for makeRequest
1 parent 50be4b3 commit 5826b7f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/dynamo/dynamo-rx.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// tslint:disable:no-empty
2+
// tslint:disable:no-unnecessary-callback-wrapper
23

34
import { Config, Credentials, DynamoDB } from 'aws-sdk'
45
import { EMPTY, Observable } from 'rxjs'
@@ -7,8 +8,7 @@ import { DynamoRx } from './dynamo-rx'
78
import { SessionValidityEnsurer } from './session-validity-ensurer.type'
89

910
describe('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

Comments
 (0)