- Refactors `trix.Encode` and `trix.Decode` to allow for dependency injection, enabling the testing of I/O error paths. - Adds comprehensive tests for the `trix` package to cover all error paths. - Adds tests for the `Fletcher` checksums and `ensureRSA` function in the `crypt` package. - Adds tests for the `lthn` package to cover the `SetKeyMap` and `GetKeyMap` functions. - Adds tests for the `chachapoly` package to cover error paths. - Adds tests for the `rsa` package to cover error paths. - Fixes the example in `examples/main.go` to work with the refactored `trix` package. - Refactors the `lthn` keymap test to be thread-safe by using a mutex and `t.Cleanup` to ensure state is properly restored. - Corrects the `mockReader` implementation in the `trix` tests to adhere to the `io.Reader` interface contract. - Removes dead code from `pkg/trix/trix.go`.
13 lines
171 B
Go
13 lines
171 B
Go
package crypt
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestEnsureRSA(t *testing.T) {
|
|
s := &Service{}
|
|
s.ensureRSA()
|
|
assert.NotNil(t, s.rsa)
|
|
}
|