irl testing pass
This commit is contained in:
parent
dfbb9e2bca
commit
02f5075d3b
5 changed files with 21 additions and 8 deletions
|
@ -13,14 +13,14 @@ import (
|
|||
|
||||
type Interactions struct {
|
||||
PublicKey ed25519.PublicKey
|
||||
Guilds discord.IGuildService
|
||||
Guilds *discord.GuildService
|
||||
Router *InteractionRouter
|
||||
|
||||
// if interactions are able to be used
|
||||
OK bool
|
||||
}
|
||||
|
||||
func NewInteractions(publicKey string, guildsService discord.IGuildService) *Interactions {
|
||||
func NewInteractions(publicKey string, guildsService *discord.GuildService) *Interactions {
|
||||
return &Interactions{
|
||||
PublicKey: ed25519.PublicKey(publicKey),
|
||||
Guilds: guildsService,
|
||||
|
|
|
@ -19,9 +19,9 @@ func TestNewInteractions(t *testing.T) {
|
|||
pub, _, _ := ed25519.GenerateKey(nil)
|
||||
key := hex.EncodeToString(pub)
|
||||
|
||||
gsm := &discord.GuildServiceMock{}
|
||||
gs := &discord.GuildService{}
|
||||
|
||||
i := interactions.NewInteractions(key, gsm)
|
||||
i := interactions.NewInteractions(key, gs)
|
||||
assert.True(t, i.OK, "interactions OK")
|
||||
assert.Equal(t, string(i.PublicKey), key, "public key accepted from args")
|
||||
}
|
||||
|
|
|
@ -16,13 +16,13 @@ import (
|
|||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func makeInteractions(t *testing.T) (*interactions.Interactions, *discord.GuildServiceMock, ed25519.PrivateKey) {
|
||||
func makeInteractions(t *testing.T) (*interactions.Interactions, *discord.GuildService, ed25519.PrivateKey) {
|
||||
pub, priv, err := ed25519.GenerateKey(nil)
|
||||
if err != nil {
|
||||
t.Errorf("makeInteractions: failed to generate key: %v", err)
|
||||
}
|
||||
|
||||
gs := &discord.GuildServiceMock{}
|
||||
gs := &discord.GuildService{}
|
||||
|
||||
i := &interactions.Interactions{
|
||||
PublicKey: pub,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue