(t *testing.T)
| 5 | ) |
| 6 | |
| 7 | func TestEncryption_EncryptDecrypt(t *testing.T) { |
| 8 | encryption, err := NewEncryption("my_secret_key") |
| 9 | if err != nil { |
| 10 | t.Errorf("Expected NewEncryption to return a non-nil error") |
| 11 | } |
| 12 | plaintext := "Hello, World!" |
| 13 | ciphertext, err := encryption.Encrypt([]byte(plaintext)) |
| 14 | if err != nil { |
| 15 | t.Errorf("Expected Encrypt to return a non-nil error") |
| 16 | } |
| 17 | decrypted, err := encryption.Decrypt(ciphertext) |
| 18 | if err != nil { |
| 19 | t.Errorf("Expected Decrypt to return a non-nil error") |
| 20 | } |
| 21 | if string(decrypted) != plaintext { |
| 22 | t.Errorf("Expected decrypted text to match original plaintext") |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | func TestEncryption_EncryptBase64DecryptBase64(t *testing.T) { |
| 27 | encryption, err := NewEncryption("my_secret_key") |
nothing calls this directly
no test coverage detected