From 720c2905d4696e0154f2a0c34c3a32f64a3a75a9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 6 Sep 2024 23:58:10 +0300 Subject: rename more --- internal/types/entry.go | 3 +- internal/types/entry_test.go | 70 ++++++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 36 deletions(-) (limited to 'internal/types') diff --git a/internal/types/entry.go b/internal/types/entry.go index 2f044f3..9f3531a 100644 --- a/internal/types/entry.go +++ b/internal/types/entry.go @@ -12,13 +12,14 @@ import ( type PlatformName = string type EntryID = string +type Epoch = int type Entry struct { // The unique ID of this entry. ID EntryID `json:"id,omitempty"` Body string `json:"body"` Shared map[PlatformName]Shared `json:"shared,omitempty"` - Epoch int `json:"epoch,omitempty"` + Epoch Epoch `json:"epoch,omitempty"` // The checksum of the whole entry, can change depending on the state. checksum string diff --git a/internal/types/entry_test.go b/internal/types/entry_test.go index a329ec7..3dde570 100644 --- a/internal/types/entry_test.go +++ b/internal/types/entry_test.go @@ -4,41 +4,6 @@ import ( "testing" ) -func oneEntry() (Entry, error) { - entry := ` - { - "body": "Body text here", - "shared": { - "Foo": { "is": true }, - "Bar": { "is": false } - } - } - ` - return NewEntry([]byte(entry)) -} - -func anotherEntry() (Entry, error) { - entry := ` - { - "body": "Body text here", - "shared": { - "Foo": { "is": true }, - "Bar": { "is": true }, - "Baz": { "is": false } - } - } - ` - return NewEntry([]byte(entry)) -} - -func twoDifferentEntries() (entry1, entry2 Entry, err error) { - if entry1, err = oneEntry(); err != nil { - return - } - entry2, err = anotherEntry() - return -} - func TestNewEntryFromJSON(t *testing.T) { entry1, err := oneEntry() if err != nil { @@ -143,3 +108,38 @@ func TestUpdate(t *testing.T) { t.Error("expected 2 shared entries after update but got", sharedCount, entry1) } } + +func oneEntry() (Entry, error) { + entry := ` + { + "body": "Body text here", + "shared": { + "Foo": { "is": true }, + "Bar": { "is": false } + } + } + ` + return NewEntry([]byte(entry)) +} + +func anotherEntry() (Entry, error) { + entry := ` + { + "body": "Body text here", + "shared": { + "Foo": { "is": true }, + "Bar": { "is": true }, + "Baz": { "is": false } + } + } + ` + return NewEntry([]byte(entry)) +} + +func twoDifferentEntries() (entry1, entry2 Entry, err error) { + if entry1, err = oneEntry(); err != nil { + return + } + entry2, err = anotherEntry() + return +} -- cgit v1.2.3