Skip to content
Snippets Groups Projects
Commit 14e5c169 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Merge branch 'hotfix/dmDocs' into 'release'

Fix dm bindings docs

See merge request !87
parents d82636a1 ab607ce6
Branches
Tags
2 merge requests!87Fix dm bindings docs,!67fix for latest client release
.PHONY: update master release update_master update_release build clean binary tests wasm_tests go_tests
clean:
rm -rf vendor/
go mod tidy
go mod vendor -e
update:
......@@ -9,7 +9,6 @@ update:
build:
GOOS=js GOARCH=wasm go build ./...
go mod tidy
update_release:
GOFLAGS="" go get -d gitlab.com/elixxir/client/v4@release
......@@ -41,7 +40,7 @@ binaries: binary worker_binaries
wasm_tests:
cp utils/utils_js.s utils/utils_js.s.bak
> utils/utils_js.s
-GOOS=js GOARCH=wasm go test ./... -v
-GOOS=js GOARCH=wasm go test -v ./...
mv utils/utils_js.s.bak utils/utils_js.s
go_tests:
......
......@@ -10,7 +10,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.5.0
github.com/spf13/jwalterweatherman v1.1.0
gitlab.com/elixxir/client/v4 v4.5.0
gitlab.com/elixxir/client/v4 v4.5.1-0.20230313165526-e67abf47404f
gitlab.com/elixxir/crypto v0.0.7-0.20230214180106-72841fd1e426
gitlab.com/elixxir/primitives v0.0.3-0.20230214180039-9a25e2d3969c
gitlab.com/xx_network/crypto v0.0.5-0.20230214003943-8a09396e95dd
......@@ -27,12 +27,10 @@ require (
github.com/cloudflare/circl v1.2.0 // indirect
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
github.com/elliotchance/orderedmap v1.4.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gobwas/ws v1.1.0 // indirect
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/improbable-eng/grpc-web v0.15.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
......@@ -40,27 +38,18 @@ require (
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.15.9 // indirect
github.com/klauspost/cpuid/v2 v2.1.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/oasisprotocol/curve25519-voi v0.0.0-20221003100820-41fad3beba17 // indirect
github.com/oasisprotocol/deoxysii v0.0.0-20220228165953-2091330c22b7 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
github.com/pkg/profile v1.6.0 // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/sethvargo/go-diceware v0.3.0 // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
github.com/soheilhy/cmux v0.1.5 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/subosito/gotenv v1.4.0 // indirect
github.com/ttacon/builder v0.0.0-20170518171403-c099f663e1c2 // indirect
github.com/ttacon/libphonenumber v1.2.1 // indirect
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
......@@ -81,9 +70,6 @@ require (
google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc // indirect
google.golang.org/grpc v1.49.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.66.6 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/sqlite v1.4.4 // indirect
gorm.io/gorm v1.24.3 // indirect
nhooyr.io/websocket v1.8.7 // indirect
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
//go:build js && wasm
package channelEventModel
package dm
import (
"crypto/ed25519"
......
......@@ -7,7 +7,7 @@
//go:build js && wasm
package channelEventModel
package dm
import (
"crypto/ed25519"
......
......@@ -7,7 +7,7 @@
//go:build js && wasm
package channelEventModel
package dm
import "gitlab.com/elixxir/xxdk-wasm/worker"
......
......@@ -327,7 +327,7 @@ func LoadChannelsManager(_ js.Value, args []js.Value) any {
// generated by [GenerateChannelIdentity] (Uint8Array).
// - args[3] - The received message callback, which is called everytime a
// message is added or changed in the database. It is a function that takes
// in the same parameters as [indexedDb.MessageReceivedCallback]. On the
// in the same parameters as [channels.MessageReceivedCallback]. On the
// Javascript side, the UUID is returned as an int and the channelID as a
// Uint8Array. The row in the database that was updated can be found using
// the UUID. The channel ID is provided so that the recipient can filter if
......
......@@ -24,16 +24,16 @@ import (
func Test_newChannelsManagerJS(t *testing.T) {
cmType := reflect.TypeOf(&ChannelsManager{})
e2e := newChannelsManagerJS(&bindings.ChannelsManager{})
if len(e2e) != cmType.NumMethod() {
cm := newChannelsManagerJS(&bindings.ChannelsManager{})
if len(cm) != cmType.NumMethod() {
t.Errorf("ChannelsManager JS object does not have all methods."+
"\nexpected: %d\nreceived: %d", cmType.NumMethod(), len(e2e))
"\nexpected: %d\nreceived: %d", cmType.NumMethod(), len(cm))
}
for i := 0; i < cmType.NumMethod(); i++ {
method := cmType.Method(i)
if _, exists := e2e[method.Name]; !exists {
if _, exists := cm[method.Name]; !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
......
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 DMClient returned by newDMClientJS contains
// all of the methods on DMClient.
func Test_newDMClientJS(t *testing.T) {
dmcType := reflect.TypeOf(&DMClient{})
dmc := newDMClientJS(&bindings.DMClient{})
if len(dmc) != dmcType.NumMethod() {
t.Errorf("DMClient JS object does not have all methods."+
"\nexpected: %d\nreceived: %d", dmcType.NumMethod(), len(dmc))
}
for i := 0; i < dmcType.NumMethod(); i++ {
method := dmcType.Method(i)
if _, exists := dmc[method.Name]; !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
// Tests that DMClient has all the methods that
// [bindings.DMClient] has.
func Test_DMClientMethods(t *testing.T) {
dmcType := reflect.TypeOf(&DMClient{})
binDmcType := reflect.TypeOf(&bindings.DMClient{})
var numOfExcludedFields int
if _, exists := dmcType.MethodByName("GetDatabaseName"); !exists {
t.Errorf("GetDatabaseName was not found.")
} else {
numOfExcludedFields++
}
nm := dmcType.NumMethod() - numOfExcludedFields
if binDmcType.NumMethod() != nm {
t.Errorf("WASM DMClient object does not have all methods from "+
"bindings.\nexpected: %d\nreceived: %d", binDmcType.NumMethod(), nm)
}
for i := 0; i < binDmcType.NumMethod(); i++ {
method := binDmcType.Method(i)
if _, exists := dmcType.MethodByName(method.Name); !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
// Tests that the map representing DMDbCipher returned by newDMDbCipherJS
// contains all of the methods on DMDbCipher.
func Test_newDMDbCipherJS(t *testing.T) {
cipherType := reflect.TypeOf(&DMDbCipher{})
cipher := newDMDbCipherJS(&bindings.DMDbCipher{})
if len(cipher) != cipherType.NumMethod() {
t.Errorf("DMDbCipher JS object does not have all methods."+
"\nexpected: %d\nreceived: %d", cipherType.NumMethod(), len(cipher))
}
for i := 0; i < cipherType.NumMethod(); i++ {
method := cipherType.Method(i)
if _, exists := cipher[method.Name]; !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
// Tests that DMDbCipher has all the methods that [bindings.DMDbCipher] has.
func Test_DMDbCipherMethods(t *testing.T) {
cipherType := reflect.TypeOf(&DMDbCipher{})
binCipherType := reflect.TypeOf(&bindings.DMDbCipher{})
if binCipherType.NumMethod() != cipherType.NumMethod() {
t.Errorf("WASM DMDbCipher object does not have all methods from "+
"bindings.\nexpected: %d\nreceived: %d",
binCipherType.NumMethod(), cipherType.NumMethod())
}
for i := 0; i < binCipherType.NumMethod(); i++ {
method := binCipherType.Method(i)
if _, exists := cipherType.MethodByName(method.Name); !exists {
t.Errorf("Method %s does not exist.", method.Name)
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment