From 4c619adda8b6619a8456a27fc18de4dfae8e6257 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 6 Jan 2023 18:01:24 +0100 Subject: [PATCH] test: pass invite args See https://github.com/ssbc/go-ssb/issues/237 --- plugins/legacyinvites/master.go | 4 ++++ tests/invite_legacy_test.go | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/plugins/legacyinvites/master.go b/plugins/legacyinvites/master.go index ec9b6bd3..8f8291cb 100644 --- a/plugins/legacyinvites/master.go +++ b/plugins/legacyinvites/master.go @@ -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] diff --git a/tests/invite_legacy_test.go b/tests/invite_legacy_test.go index 793c3731..081ea8dd 100644 --- a/tests/invite_legacy_test.go +++ b/tests/invite_legacy_test.go @@ -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 @@ -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") @@ -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)