// Ensure that a user can be persisted to the database. func TestTx_SaveUser(t *testing.T) { db := NewTestDB() defer db.Close() testutil.Ok(t, db.Update(func(tx *Tx) error { testutil.Ok(t, tx.SaveUser(dbExampleUser)) return nil })) testutil.Ok(t, db.View(func(tx *Tx) error { u, _ := tx.User("U100") testutil.Equals(t, dbExampleUser, u) return nil })) }
// Ensue that a meta string can be persisted to the database. func TestTx_SetMeta(t *testing.T) { db := NewTestDB() defer db.Close() key := "foo" val := "bar" testutil.Ok(t, db.Update(func(tx *Tx) error { testutil.Ok(t, tx.SetMeta(key, val)) return nil })) testutil.Ok(t, db.View(func(tx *Tx) error { meta := tx.Meta(key) testutil.Equals(t, meta, val) return nil })) }