MCPcopy Index your code
hub / github.com/dnote/dnote / TestGetLastSyncAt

Function TestGetLastSyncAt

pkg/cli/cmd/sync/sync_test.go:105–125  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestGetLastSyncAt(t *testing.T) {
106 // set up
107 db := database.InitTestMemoryDB(t)
108 database.MustExec(t, "setting up last_sync_at", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastSyncAt, 1541108743)
109
110 // exec
111 tx, err := db.Begin()
112 if err != nil {
113 t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
114 }
115
116 got, err := getLastSyncAt(tx)
117 if err != nil {
118 t.Fatal(errors.Wrap(err, "getting last_sync_at").Error())
119 }
120
121 tx.Commit()
122
123 // test
124 assert.Equal(t, got, 1541108743, "last_sync_at mismatch")
125}
126
127func TestGetLastMaxUSN(t *testing.T) {
128 // set up

Callers

nothing calls this directly

Calls 7

InitTestMemoryDBFunction · 0.92
MustExecFunction · 0.92
EqualFunction · 0.92
getLastSyncAtFunction · 0.85
BeginMethod · 0.65
CommitMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected