aboutsummaryrefslogtreecommitdiff
path: root/kamus_cache_test.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-03-31 01:11:26 +0700
committerShulhan <m.shulhan@gmail.com>2020-04-01 06:28:03 +0700
commit8a141995aabdee289d2b096bd77a10b52b08a1bf (patch)
tree98af569d4c3e2620809ce591c2733184cd77db8f /kamus_cache_test.go
parent84fdfdb6ae4175a125fc67a6aed377476d31ee0e (diff)
downloadkamusku-8a141995aabdee289d2b096bd77a10b52b08a1bf.tar.xz
all: implement server and client for dictionary API
Currently the server and client can onyl handle API for looking up definitions of the words through "/api/definisi" URL.
Diffstat (limited to 'kamus_cache_test.go')
-rw-r--r--kamus_cache_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/kamus_cache_test.go b/kamus_cache_test.go
new file mode 100644
index 0000000..fbeda02
--- /dev/null
+++ b/kamus_cache_test.go
@@ -0,0 +1,36 @@
+// Copyright 2020, Shulhan <m.shulhan@gmail.com>. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package kbbi
+
+import (
+ "testing"
+
+ "github.com/shuLhan/share/lib/test"
+)
+
+const (
+ testStoragePath = "testdata/kamus.gob"
+)
+
+func TestKamusCache_store_load(t *testing.T) {
+ exp, err := newKamusCache(testStoragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ exp.set("mengeja", testKataMengeja)
+
+ err = exp.store()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ got, err := newKamusCache(testStoragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ test.Assert(t, "store and load", exp, got, true)
+}