diff options
author | Martin Czygan <martin@archive.org> | 2021-07-26 17:43:04 +0000 |
---|---|---|
committer | Martin Czygan <martin@archive.org> | 2021-07-26 17:43:04 +0000 |
commit | aeaa60211e33cb49da98770b3461cbca2c2a65cc (patch) | |
tree | 1def8dfcd4d2c035a8b5ee6d88507a1ad53a8b40 /skate/schema_test.go | |
parent | befd7895262e2469367e2a4f71f78148b9986dee (diff) | |
parent | 0d4c3ca311b1057bdb07144b0ac8ba860be2de55 (diff) | |
download | refcat-aeaa60211e33cb49da98770b3461cbca2c2a65cc.tar.gz refcat-aeaa60211e33cb49da98770b3461cbca2c2a65cc.zip |
Merge branch 'bnewbold-skate-tweaks' into 'master'
proposed changes and fixes to skate matching
See merge request martin/cgraph!3
Diffstat (limited to 'skate/schema_test.go')
-rw-r--r-- | skate/schema_test.go | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/skate/schema_test.go b/skate/schema_test.go index 3267072..59b1f58 100644 --- a/skate/schema_test.go +++ b/skate/schema_test.go @@ -1,6 +1,7 @@ package skate import ( + "bytes" "encoding/json" "fmt" "reflect" @@ -220,11 +221,11 @@ func TestLinkHash(t *testing.T) { }{ { bref: BiblioRef{}, - linkHash: "7cae9fc61f167bc26cc3839f15457fe87b2be4e1", + linkHash: "8b8c3f74dd1472aa8869ee3a58295b70c7064aa8", }, { bref: BiblioRef{SourceReleaseIdent: "123"}, - linkHash: "a0969f96c14cb42d298117e1927bd409873173a2", + linkHash: "23d0f9e279ec533f46a6b220f7a5758ec0c9d9af", }, { bref: BiblioRef{ @@ -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{ + Parts: [][]int{{2012}}, + }, + } + var csl_json = []byte(`{"issued":{"date-parts":[[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 |