Skip to content
Snippets Groups Projects
Commit a2c1fb23 authored by Jake Taylor's avatar Jake Taylor
Browse files

Merge branch 'release' into project/DM

parents 1a89f853 8f3ed6e1
No related branches found
No related tags found
3 merge requests!60Revert "Fail a test to be sure it works",!36project/DM,!32Admin Commands
......@@ -65,7 +65,7 @@ version_check:
script:
- GITTAG=$(git describe --tags)
- CODEVERS=$(cat storage/version.go | grep "const SEMVER =" | cut -d ' ' -f4 | tr -d '"')
- if [[ $GITTAG != $CODEVERS ]]; then echo "VERSION NUMBER BAD $GITTAG != $CODEVER"; exit -1; fi
- if [[ $GITTAG != $CODEVERS ]]; then echo "VERSION NUMBER BAD $GITTAG != $CODEVERS"; exit -1; fi
tag:
stage: build
......
......@@ -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