Skip to content

Commit eb9a024

Browse files
committed
convert test to use mockito
1 parent 3a480f4 commit eb9a024

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/test/ec2/model.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { Ec2Client } from '../../shared/clients/ec2Client'
1111
import { Ec2Selection } from '../../ec2/utils'
1212
import { ToolkitError } from '../../shared/errors'
1313
import { IAM } from 'aws-sdk'
14-
import { mock } from 'ts-mockito'
1514
import { SshKeyPair } from '../../ec2/sshKeyPair'
1615
import { DefaultIamClient } from '../../shared/clients/iamClient'
1716

@@ -160,12 +159,12 @@ describe('Ec2ConnectClient', function () {
160159
describe('sendSshKeysToInstance', async function () {
161160
it('calls the sdk with the proper parameters', async function () {
162161
const sendCommandStub = sinon.stub(SsmClient.prototype, 'sendCommandAndWait')
163-
162+
sinon.stub(SshKeyPair, 'generateSshKeyPair')
164163
const testSelection = {
165164
instanceId: 'test-id',
166165
region: 'test-region',
167166
}
168-
const mockKeys = mock() as SshKeyPair
167+
const mockKeys = await SshKeyPair.getSshKeyPair('')
169168
await client.sendSshKeyToInstance(testSelection, mockKeys, '')
170169
sinon.assert.calledWith(sendCommandStub, testSelection.instanceId, 'AWS-RunShellScript')
171170
sinon.restore()

0 commit comments

Comments
 (0)