answer/internal/repo/repo_test/email_repo_test.go

21 lines
489 B
Go
Raw Normal View History

2022-10-26 16:24:58 +08:00
package repo_test
import (
"context"
"testing"
"github.com/answerdev/answer/internal/repo/export"
"github.com/stretchr/testify/assert"
)
func Test_emailRepo_VerifyCode(t *testing.T) {
2022-10-26 16:59:33 +08:00
emailRepo := export.NewEmailRepo(testDataSource)
2022-10-26 16:24:58 +08:00
code, content := "1111", "test"
err := emailRepo.SetCode(context.TODO(), code, content)
assert.NoError(t, err)
verifyContent, err := emailRepo.VerifyCode(context.TODO(), code)
assert.NoError(t, err)
assert.Equal(t, content, verifyContent)
}