Files
old-backend/shared/encryption_test.go

23 lines
509 B
Go
Raw Normal View History

2023-09-18 12:27:40 +02:00
package shared
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestEncryptionClient(t *testing.T) {
client := encryptionClient{Secret: `abc&1*~#^2^#s0^=)^^7%b34`}
t.Run("encrypt/ decyrpt works", func(t *testing.T) {
text := "sample text to test encryption"
encodedText, err := client.Encrypt(text)
assert.NoError(t, err)
assert.NotEqual(t, text, encodedText)
decodedText, err := client.Decrypt(encodedText)
assert.NoError(t, err)
assert.Equal(t, text, decodedText)
})
}