feat: EC2 UI polished + storage persisting

This commit is contained in:
Zakaria
2026-09-25 18:18:33 -04:00
parent 1b129e9dcf
commit 093afb9b2b
40 changed files with 2586 additions and 102 deletions
+15 -2
View File
@@ -214,7 +214,7 @@ describe('ec2Service key pairs', () => {
expect(result).toEqual([])
})
test('createKeyPair sends CreateKeyPairCommand and returns material', async () => {
test('createKeyPair sends CreateKeyPairCommand with the requested key type and returns material', async () => {
const sent: unknown[] = []
const client: EC2Client = {
send: async (cmd: unknown) => {
@@ -222,12 +222,25 @@ describe('ec2Service key pairs', () => {
return {KeyPairId: 'kp-1', KeyName: 'my-key', KeyMaterial: '-----BEGIN RSA-----'}
},
} as unknown as EC2Client
const result = await createEc2Service(client).createKeyPair('my-key')
const result = await createEc2Service(client).createKeyPair('my-key', 'ed25519')
expect(sent[0]).toBeInstanceOf(CreateKeyPairCommand)
expect((sent[0] as CreateKeyPairCommand).input).toMatchObject({KeyName: 'my-key', KeyType: 'ed25519'})
expect(result.keyName).toBe('my-key')
expect(result.keyMaterial).toBe('-----BEGIN RSA-----')
})
test('createKeyPair defaults to rsa', async () => {
const sent: CreateKeyPairCommand[] = []
const client: EC2Client = {
send: async (cmd: CreateKeyPairCommand) => {
sent.push(cmd)
return {}
},
} as unknown as EC2Client
await createEc2Service(client).createKeyPair('my-key')
expect(sent[0].input.KeyType).toBe('rsa')
})
test('deleteKeyPair sends DeleteKeyPairCommand', async () => {
const sent: unknown[] = []
const client: EC2Client = {send: async (cmd: unknown) => { sent.push(cmd); return {} }} as unknown as EC2Client