Skip to content
Snippets Groups Projects
Commit ad94647d authored by Jono Wenger's avatar Jono Wenger
Browse files

XX-4460 / channel file transfer bindings

parent 2c5409eb
Branches
Tags
3 merge requests!83XX-4460 / channel file transfer bindings,!71Project/file upload,!67fix for latest client release
......@@ -7,7 +7,7 @@ require (
github.com/hack-pad/go-indexeddb v0.2.0
github.com/pkg/errors v0.9.1
github.com/spf13/jwalterweatherman v1.1.0
gitlab.com/elixxir/client/v4 v4.6.2-0.20230405174419-7a880a2be748
gitlab.com/elixxir/client/v4 v4.6.2-0.20230405181235-5ee75042bd4d
gitlab.com/elixxir/crypto v0.0.7-0.20230405173828-f811be53be9a
gitlab.com/elixxir/primitives v0.0.3-0.20230214180039-9a25e2d3969c
gitlab.com/xx_network/crypto v0.0.5-0.20230214003943-8a09396e95dd
......
......@@ -391,8 +391,8 @@ github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo=
github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4=
gitlab.com/elixxir/bloomfilter v0.0.0-20230315224936-a4459418f300 h1:oF3Pkf5NBb48KB89Q4sQXKQCIsWp1IVsqKWHWFsfBRc=
gitlab.com/elixxir/bloomfilter v0.0.0-20230315224936-a4459418f300/go.mod h1:1X8gRIAPDisS3W6Vtr/ymiUmZMJUIwDV1o5DEOo/pzw=
gitlab.com/elixxir/client/v4 v4.6.2-0.20230405174419-7a880a2be748 h1:fR+FxlaDXRN9rbcF6cpXP8YyCJH0xzoZrbJTB9Lkxn4=
gitlab.com/elixxir/client/v4 v4.6.2-0.20230405174419-7a880a2be748/go.mod h1:5ndu2D6dIswTmcY9cPs0/3bBS0F7P2DGCoHz/zU2evk=
gitlab.com/elixxir/client/v4 v4.6.2-0.20230405181235-5ee75042bd4d h1:22rC9C+XocPXMS4/Rnbo9JyCPNhm++jBA707WEth6pU=
gitlab.com/elixxir/client/v4 v4.6.2-0.20230405181235-5ee75042bd4d/go.mod h1:5ndu2D6dIswTmcY9cPs0/3bBS0F7P2DGCoHz/zU2evk=
gitlab.com/elixxir/comms v0.0.4-0.20230310205528-f06faa0d2f0b h1:8AVK93UEs/aufoqtFgyMVt9gf0oJ8F4pA60ZvEVvG+s=
gitlab.com/elixxir/comms v0.0.4-0.20230310205528-f06faa0d2f0b/go.mod h1:z+qW0D9VpY5QKTd7wRlb5SK4kBNqLYsa4DXBcUXue9Q=
gitlab.com/elixxir/crypto v0.0.7-0.20230405173828-f811be53be9a h1:0LtIGmpl8cn11yBj8vyd7TiTNQPGXAdyASpm6+10uwY=
......
......@@ -94,6 +94,10 @@ func main() {
js.Global().Set("NewChannelsDatabaseCipher",
js.FuncOf(wasm.NewChannelsDatabaseCipher))
// wasm/dm.go
js.Global().Set("InitChannelsFileTransfer",
js.FuncOf(wasm.InitChannelsFileTransfer))
// wasm/dm.go
js.Global().Set("NewDMClient", js.FuncOf(wasm.NewDMClient))
js.Global().Set("NewDMClientWithIndexedDb",
......
This diff is collapsed.
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2022 xx foundation //
// //
// Use of this source code is governed by a license that can be found in the //
// LICENSE file. //
////////////////////////////////////////////////////////////////////////////////
//go:build js && wasm
package wasm
import (
"gitlab.com/elixxir/client/v4/bindings"
"reflect"
"testing"
)
// Tests that the map representing ChannelsFileTransfer returned by
// newChannelsFileTransferJS contains all of the methods on ChannelsFileTransfer.
func Test_newChannelsFileTransferJS(t *testing.T) {
cftType := reflect.TypeOf(&ChannelsFileTransfer{})
ft := newChannelsFileTransferJS(&bindings.ChannelsFileTransfer{})
if len(ft) != cftType.NumMethod() {
t.Errorf("ChannelsFileTransfer JS object does not have all methods."+
"\nexpected: %d\nreceived: %d", cftType.NumMethod(), len(ft))
}
for i := 0; i < cftType.NumMethod(); i++ {
method := cftType.Method(i)
if _, exists := ft[method.Name]; !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
// Tests that ChannelsFileTransfer has all the methods that
// [bindings.ChannelsFileTransfer] has.
func Test_ChannelsFileTransferMethods(t *testing.T) {
cftType := reflect.TypeOf(&ChannelsFileTransfer{})
binCftType := reflect.TypeOf(&bindings.ChannelsFileTransfer{})
if binCftType.NumMethod() != cftType.NumMethod() {
t.Errorf("WASM ChannelsFileTransfer object does not have all methods "+
"from bindings.\nexpected: %d\nreceived: %d",
binCftType.NumMethod(), cftType.NumMethod())
}
for i := 0; i < binCftType.NumMethod(); i++ {
method := binCftType.Method(i)
if _, exists := cftType.MethodByName(method.Name); !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
// Tests that the map representing ChFilePartTracker returned by
// newChFilePartTrackerJS contains all of the methods on ChFilePartTracker.
func Test_newChFilePartTrackerJS(t *testing.T) {
fptType := reflect.TypeOf(&FilePartTracker{})
fpt := newChFilePartTrackerJS(&bindings.ChFilePartTracker{})
if len(fpt) != fptType.NumMethod() {
t.Errorf("ChFilePartTracker JS object does not have all methods."+
"\nexpected: %d\nreceived: %d", fptType.NumMethod(), len(fpt))
}
for i := 0; i < fptType.NumMethod(); i++ {
method := fptType.Method(i)
if _, exists := fpt[method.Name]; !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
// Tests that ChFilePartTracker has all the methods that
// [bindings.ChFilePartTracker] has.
func Test_ChFilePartTrackerMethods(t *testing.T) {
fptType := reflect.TypeOf(&ChFilePartTracker{})
binFptType := reflect.TypeOf(&bindings.ChFilePartTracker{})
if binFptType.NumMethod() != fptType.NumMethod() {
t.Errorf("WASM ChFilePartTracker object does not have all methods from "+
"bindings.\nexpected: %d\nreceived: %d",
binFptType.NumMethod(), fptType.NumMethod())
}
for i := 0; i < binFptType.NumMethod(); i++ {
method := binFptType.Method(i)
if _, exists := fptType.MethodByName(method.Name); !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
......@@ -15,6 +15,7 @@ import (
"gitlab.com/elixxir/client/v4/auth"
"gitlab.com/elixxir/client/v4/catalog"
"gitlab.com/elixxir/client/v4/channels"
"gitlab.com/elixxir/client/v4/channelsFileTransfer"
"gitlab.com/elixxir/client/v4/cmix"
"gitlab.com/elixxir/client/v4/cmix/message"
"gitlab.com/elixxir/client/v4/connect"
......@@ -69,4 +70,6 @@ var (
_ = broadcast.Channel{}
_ = netTime.Now
_ = ed25519.PublicKey{}
_ = channelsFileTransfer.Params{}
_ = fileTransfer.ID{}
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment