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

Function TestGetLastMaxUSN

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

Source from the content-addressed store, hash-verified

125}
126
127func TestGetLastMaxUSN(t *testing.T) {
128 // set up
129 db := database.InitTestMemoryDB(t)
130 database.MustExec(t, "setting up last_max_usn", db, "INSERT INTO system (key, value) VALUES (?, ?)", consts.SystemLastMaxUSN, 20001)
131
132 // exec
133 tx, err := db.Begin()
134 if err != nil {
135 t.Fatal(errors.Wrap(err, "beginning a transaction").Error())
136 }
137
138 got, err := getLastMaxUSN(tx)
139 if err != nil {
140 t.Fatal(errors.Wrap(err, "getting last_max_usn").Error())
141 }
142
143 tx.Commit()
144
145 // test
146 assert.Equal(t, got, 20001, "last_max_usn mismatch")
147}
148
149func TestResolveLabel(t *testing.T) {
150 testCases := []struct {

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected