Compare commits

..

No commits in common. "6fe7fe009e24ac868a31f3670df11840542ad5ed" and "4e37009599c53b82527d31dadf37a8b8daa51271" have entirely different histories.

3 changed files with 6 additions and 59 deletions

View File

@ -8,7 +8,7 @@ import (
var SyncCmd = &cli.Command{
Name: "sync",
Usage: "Synchronize with server",
Usage: "Synchonize with server",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "full",
@ -26,10 +26,6 @@ func NewSyncCmd(client *client.Client, localRepo storage.LocalID, eventRepo stor
}
func Sync(client *client.Client, localRepo storage.LocalID, eventRepo storage.Event, full bool) error {
// find local new and updated
// send new and updated
//
// get new/updated items
// delete deleted
@ -38,5 +34,9 @@ func Sync(client *client.Client, localRepo storage.LocalID, eventRepo storage.Ev
// localid and add new
// find local new and updated
// send new and updated
return nil
}

View File

@ -1,45 +1,14 @@
package memory_test
import (
"fmt"
"testing"
"go-mod.ewintr.nl/planner/item"
"go-mod.ewintr.nl/planner/plan/storage/memory"
)
import "testing"
func TestSync(t *testing.T) {
t.Parallel()
mem := memory.NewSync()
t.Log("store")
count := 3
for i := 0; i < count; i++ {
mem.Store(item.Item{
ID: fmt.Sprintf("id-%d", i),
})
}
t.Log("find all")
actItems, actErr := mem.FindAll()
if actErr != nil {
t.Errorf("exp nil, got %v", actErr)
}
if len(actItems) != count {
t.Errorf("exp %v, got %v", count, len(actItems))
}
t.Log("delete all")
if err := mem.DeleteAll(); err != nil {
t.Errorf("exp nil, got %v", err)
}
actItems, actErr = mem.FindAll()
if actErr != nil {
t.Errorf("exp nil, got %v", actErr)
}
if len(actItems) != 0 {
t.Errorf("exp 0, got %v", len(actItems))
}
}

View File

@ -1,22 +0,0 @@
package client
import (
"time"
"go-mod.ewintr.nl/planner/item"
)
type Memory struct {
}
func NewMemory() *Memory {
return &Memory{}
}
func (m *Memory) Update(items []item.Item) error {
return nil
}
func (m *Memory) Updated(kw []item.Kind, ts time.Time) ([]item.Item, error) {
return nil, nil
}