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

Merge remote-tracking branch 'origin/release' into project/adminCommands

# Conflicts:
#	go.mod
#	go.sum
#	indexedDb/channels/implementation_test.go
parents de4d0a83 8f3ed6e1
No related branches found
No related tags found
2 merge requests!60Revert "Fail a test to be sure it works",!32Admin Commands
......@@ -25,6 +25,8 @@ stages:
build:
stage: build
except:
- tags
script:
- go mod vendor -v
- mkdir -p release
......@@ -36,6 +38,8 @@ build:
wasm-test:
stage: test
except:
- tags
script:
- export PATH=/root/go/bin:$PATH
- echo > utils/utils_js.s
......@@ -44,23 +48,29 @@ wasm-test:
go-test:
stage: test
except:
- tags
script:
- go mod vendor -v
- go test ./... -v
version_check:
stage: version_check
except:
- tags
only:
- master
- release
image: $DOCKER_IMAGE
script:
- GITTAG=$(git describe --tags)
- CODEVERS=$(cat utils/version.go | grep "const SEMVER =" | cut -d ' ' -f4 | tr -d '"')
- if [[ $GITTAG != $CODEVERS ]]; then echo "VERSION NUMBER BAD $GITTAG != $CODEVER"; exit -1; fi
- CODEVERS=$(cat storage/version.go | grep "const SEMVER =" | cut -d ' ' -f4 | tr -d '"')
- if [[ $GITTAG != $CODEVERS ]]; then echo "VERSION NUMBER BAD $GITTAG != $CODEVERS"; exit -1; fi
tag:
stage: build
except:
- tags
image: $DOCKER_IMAGE
script:
- git remote add origin_tags git@$GITLAB_SERVER:elixxir/xxdk-wasm.git || true
......@@ -76,6 +86,8 @@ tag:
# master/release, this will fail to pull the latest client, and the docs will not update.
doc-update:
stage: doc-update
except:
- tags
image: $DOCKER_IMAGE
script:
# We use GOPRIVATE blank because not want to directly pull client, we want to use the public cache.
......
This diff is collapsed.
......@@ -18,7 +18,7 @@ import (
)
// SEMVER is the current semantic version of xxDK WASM.
const SEMVER = "0.1.10"
const SEMVER = "0.1.13"
// Storage keys.
const (
......
......@@ -32,6 +32,10 @@ func CopyBytesToJS(src []byte) js.Value {
// JsToJson converts the Javascript value to JSON.
func JsToJson(value js.Value) string {
if value.IsUndefined() {
return "null"
}
return JSON.Call("stringify", value).String()
}
......
......@@ -113,6 +113,22 @@ func TestJsToJson(t *testing.T) {
}
}
// Tests that JsToJson return a null object when the Javascript object is
// undefined.
func TestJsToJson_Undefined(t *testing.T) {
expected, err := json.Marshal(nil)
if err != nil {
t.Errorf("Failed to JSON marshal test object: %+v", err)
}
jsJson := JsToJson(js.Undefined())
if string(expected) != jsJson {
t.Errorf("Recieved incorrect JSON from Javascript object."+
"\nexpected: %s\nreceived: %s", expected, jsJson)
}
}
// Tests that JsonToJS can convert a JSON object with multiple types to a
// Javascript object and that all values match.
func TestJsonToJS(t *testing.T) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment