2018-10-06 03:50:55 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
|
|
|
"cwtch.im/cwtch/peer"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestFileProfileStore(t *testing.T) {
|
2019-01-14 20:09:25 +00:00
|
|
|
fileStore := NewFileStore(".test.json", "password")
|
2018-10-06 03:50:55 +00:00
|
|
|
alice := peer.NewCwtchPeer("alice")
|
|
|
|
fileStore.Save(alice)
|
|
|
|
|
|
|
|
aliceLoaded, err := fileStore.Load()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("alice profile should have been loaded from store instead %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if aliceLoaded.GetProfile().Name != "alice" {
|
|
|
|
t.Errorf("alice profile should have been loaded from store instead %v", aliceLoaded)
|
|
|
|
}
|
|
|
|
}
|