collabtest

package
v0.22.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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 NewFake

func NewFake() *Fake

NewFake is an empty Caster.

func (*Fake) Call

func (f *Fake) Call(_ context.Context, tool string, args map[string]any) (string, error)

func (*Fake) Content

func (f *Fake) Content(key string) (string, int)

Content is the latest text of "<ns>/<name>", and its revision (0: no such item).

func (f *Fake) Link() (tetherlink.Caller, error)

Link is the Fake as a Store's Link.

func (*Fake) Put

func (f *Fake) Put(key, content, title, tags string) int

Put writes a revision directly, as another app would, by Caster's rules (putLocked).

func (*Fake) Revs

func (f *Fake) Revs(key string) int

Revs is how many revisions "<ns>/<name>" has.

func (*Fake) Tags

func (f *Fake) Tags(key string) string

Tags are the latest tags of "<ns>/<name>".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL