aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2021-07-24 18:12:53 -0700
committerBryan Newbold <bnewbold@archive.org>2021-07-24 18:12:53 -0700
commitf5575f41f799be9bdfd9d0406710aeebe20d6350 (patch)
tree32b3b7bc85f94472238cd69c1307c51024c00d31
parent05de691fbc8ab72741b61d310c90dbc770fd4b3a (diff)
downloadrefcat-f5575f41f799be9bdfd9d0406710aeebe20d6350.tar.gz
refcat-f5575f41f799be9bdfd9d0406710aeebe20d6350.zip
add test for issued,accessed not being included in output JSON
-rw-r--r--skate/schema_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/skate/schema_test.go b/skate/schema_test.go
index 3267072..7616001 100644
--- a/skate/schema_test.go
+++ b/skate/schema_test.go
@@ -1,6 +1,7 @@
package skate
import (
+ "bytes"
"encoding/json"
"fmt"
"reflect"
@@ -256,6 +257,22 @@ func TestLinkHash(t *testing.T) {
}
}
+func TestSchemaMarshal(t *testing.T) {
+
+ // CSL when issued is empty, but accepted is not
+ var csl = CSL{
+ Title: "test-doc",
+ Issued: &CSLDate{
+ Raw: "2012",
+ },
+ }
+ var csl_json = []byte(`{"issued":{"raw":"2012"},"title":"test-doc"}`)
+ var csl_encoded, _ = json.Marshal(csl)
+ if bytes.Compare(csl_json, csl_encoded) != 0 {
+ t.Fatalf("got:\n%v\nwant:\n%v\n", string(csl_json[:]), string(csl_encoded[:]))
+ }
+}
+
func TestReleaseToUnstructured(t *testing.T) {
var cases = []struct {
r *Release