Skip to content

Commit

Permalink
test: pass invite args
Browse files Browse the repository at this point in the history
  • Loading branch information
decentral1se committed Jan 6, 2023
1 parent d83e578 commit 4c619ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions plugins/legacyinvites/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ func (h createHandler) HandleCall(ctx context.Context, req *muxrpc.Request) {
req.CloseWithError(fmt.Errorf("unable to receive invite create payload: %w", err))
return
}
if len(args) == 0 {
req.CloseWithError(fmt.Errorf("missing invite create payload?"))
return
}

a := args[0]

Expand Down
11 changes: 5 additions & 6 deletions tests/invite_legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/ssbc/go-ssb/client"
"github.com/ssbc/go-ssb/internal/testutils"
"github.com/ssbc/go-ssb/invite"
"github.com/ssbc/go-ssb/plugins/legacyinvites"
)

// first js creates an invite
Expand Down Expand Up @@ -165,11 +166,6 @@ func TestLegacyInviteJSCreate(t *testing.T) {
}

func TestLegacyInviteJSAccept(t *testing.T) {
if testutils.SkipOnCI(t) {
// https://github.com/ssbc/go-ssb/pull/170
return
}

r := require.New(t)

os.Remove("legacy_invite.txt")
Expand Down Expand Up @@ -205,8 +201,11 @@ func TestLegacyInviteJSAccept(t *testing.T) {
master, err := client.NewTCP(bob.KeyPair, wrappedAddr)
r.NoError(err)

var args legacyinvites.CreateArguments
args.Uses = 1

var invite string
err = master.Async(context.TODO(), &invite, muxrpc.TypeString, muxrpc.Method{"invite", "create"})
err = master.Async(context.TODO(), &invite, muxrpc.TypeString, muxrpc.Method{"invite", "create"}, args)
r.NoError(err)
t.Log(invite)

Expand Down

0 comments on commit 4c619ad

Please sign in to comment.