Documentation
¶
Overview ¶
Package collabtest is an in-memory Caster for tests of code that reads and writes Caster through module/tetherlink (module/collab, a module's own Caster sync). Tests only.
Index ¶
- type Fake
- func (f *Fake) Call(_ context.Context, tool string, args map[string]any) (string, error)
- func (f *Fake) Content(key string) (string, int)
- func (f *Fake) Link() (tetherlink.Caller, error)
- func (f *Fake) Put(key, content, title, tags string) int
- func (f *Fake) Revs(key string) int
- func (f *Fake) Tags(key string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Fake ¶
type Fake struct {
// Calls are the tools called, in order.
Calls []string
// Down makes every call fail, as an unreachable gateway does.
Down bool
// BeforePut, when set, runs before each caster_put with the item's key: a test writes there
// as someone else would between a read and a write.
BeforePut func(key string)
// Fail, when set, fails a call it returns true for (a tool, its arguments).
Fail func(tool string, args map[string]any) bool
// contains filtered or unexported fields
}
Fake is an in-memory Caster for tests: caster_get, caster_put, caster_ls and caster_log over items by "<ns>/<name>", each a list of revisions, answered in the gateway's shapes and with its rules: a put of the text an item already has keeps its revision, and a put with no title or tags keeps the last ones. It is a tetherlink.Caller; Link hands it to a collab.Store.
func (*Fake) Content ¶
Content is the latest text of "<ns>/<name>", and its revision (0: no such item).
func (*Fake) Link ¶
func (f *Fake) Link() (tetherlink.Caller, error)
Link is the Fake as a Store's Link.
func (*Fake) Put ¶
Put writes a revision directly, as another app would, by Caster's rules (putLocked).