Documentation
¶
Overview ¶
Package contenttest runs one set of behaviour cases against any content, type, site setting or user setting store.
Index ¶
- Constants
- func AddressOf(t *testing.T, store content.Store, id uuid.UUID) string
- func AutosaveValuesOf(t *testing.T, store content.Store, item content.Content, author uuid.UUID) content.Values
- func CarType(t *testing.T) content.Type
- func CategoryType() content.Type
- func DeclareFields(t *testing.T, types content.TypeStore, fields ...content.Field) content.Group
- func DeclareFlexible(t *testing.T, types content.TypeStore) content.Field
- func DeclareLayout(t *testing.T, types content.TypeStore, parentID int, key string) content.Field
- func DeclareOnType(t *testing.T, types content.TypeStore, typeKey string, f content.Field) content.Field
- func DeclareRepeater(t *testing.T, types content.TypeStore, key string) content.Field
- func DeclareSection(t *testing.T, types content.TypeStore, key string) content.Field
- func DeclareTypedField(t *testing.T, types content.TypeStore, typeKey, key string) content.Field
- func DeclareUnder(t *testing.T, types content.TypeStore, parentID int, key string) content.Field
- func DeclaredInside(t *testing.T, types content.TypeStore, parent content.Field, key string, ...) content.Field
- func DeclaredInto(t *testing.T, registry *content.Registry)
- func DeclaredSectionInto(t *testing.T, registry *content.Registry) (content.Field, content.Field)
- func EditTitle(p content.Content, title string) content.Content
- func FieldOn(t *testing.T, typeKey, key string, kind content.FieldKind, relatesTo string) content.Field
- func FieldsGroupOf(t *testing.T, types content.TypeStore, typeKey string) content.Group
- func FileUnder(t *testing.T, store content.Store, post content.Content, targets ...uuid.UUID) content.Content
- func FlatPage() content.Type
- func GroupAt(t *testing.T, types content.TypeStore, id int) content.Group
- func GroupHolding(t *testing.T, types content.TypeStore, key string) int
- func GroupOf(groups []content.Group, id int) (content.Group, bool)
- func GroupOn(t *testing.T, types content.TypeStore, title, typeKey string) content.Group
- func HeldTargets(t *testing.T, c content.Content) []uuid.UUID
- func Holding(t *testing.T, store content.Store, title string, author uuid.UUID, ...) content.Content
- func LocationOf(typeKey string) content.Rules
- func MustAutosave(t *testing.T, p content.Content, author uuid.UUID) content.Revision
- func MustCreate(t *testing.T, store content.Store, title string, author uuid.UUID) content.Content
- func MustFlexible(t *testing.T, key string) content.Field
- func MustNest(t *testing.T, store content.Store, parent *content.Content, title string, ...) content.Content
- func MustPost(t *testing.T, title string, author uuid.UUID) content.Content
- func MustSnapshot(t *testing.T, p content.Content, author uuid.UUID) *content.Revision
- func NamedTargets(targets []uuid.UUID) []any
- func PageType() content.Type
- func ParkValues(t *testing.T, store content.Store, item content.Content, author uuid.UUID, ...)
- func PointedAtBy(t *testing.T, store content.Store, target uuid.UUID) int
- func PostField(key string, kind content.FieldKind) content.Field
- func PostType() content.Type
- func Publish(t *testing.T, store content.Store, title string, author uuid.UUID, ...) content.Content
- func PublishItem(t *testing.T, store content.Store, c content.Content) content.Content
- func ReadersOn(t *testing.T, types content.TypeStore, typeKey, relation string) (content.Group, content.Field)
- func RegisterCategoryType(t *testing.T, types content.TypeStore)
- func RegisterPageType(t *testing.T, types content.TypeStore)
- func RelateToCategories(t *testing.T, types content.TypeStore)
- func RelationInside(t *testing.T, types content.TypeStore, parent content.Field, key string) content.Field
- func Rested(t *testing.T, types content.TypeStore, title string) content.Group
- func RestingTwinOf(t *testing.T, types content.TypeStore, key string) content.Field
- func RevisionValuesOf(t *testing.T, store content.Store, revision content.Revision) content.Values
- func RivalOnTruck(t *testing.T, types content.TypeStore, key string) content.Group
- func RowsFiledUnder(targets ...uuid.UUID) content.Values
- func RowsPointing(t *testing.T, types content.TypeStore) content.Field
- func Run(t *testing.T, fresh Factory)
- func RunSiteSettings(t *testing.T, fresh Factory)
- func RunTypes(t *testing.T, fresh Factory)
- func RunUserSettings(t *testing.T, fresh Factory)
- func SectionChainOnCar(t *testing.T, types content.TypeStore, registry *content.Registry, depth int) content.Field
- func SectionOn(t *testing.T, key string) content.Field
- func ServingEverything(t *testing.T, types content.TypeStore) content.Group
- func StalePage(t *testing.T, parent *content.Content, title string, author uuid.UUID) content.Content
- func StillStored(t *testing.T, store content.Store, item content.Content) bool
- func StoreItem(t *testing.T, store content.Store, kind content.Type, parent *content.Content, ...) content.Content
- func StoreType(t *testing.T, types content.TypeStore, key string)
- func StoredCategory(t *testing.T, store content.Store, title string, author uuid.UUID) content.Content
- func TitleIn(t *testing.T, types content.TypeStore, groupID int) content.Field
- func TitlesOf(posts []content.ListedItem) []string
- func Trash(t *testing.T, store content.Store, item content.Content)
- func TypedHolding(t *testing.T, types content.TypeStore, store content.Store, ...) (content.Content, content.Revision)
- func ValuesOf(t *testing.T, store content.Store, id uuid.UUID) content.Values
- type Case
- type Factory
- type Stores
Constants ¶
const DefaultAuthor = "Maria Perez"
DefaultAuthor is the name the suite gives the account most cases write as.
Variables ¶
This section is empty.
Functions ¶
func AutosaveValuesOf ¶
func AutosaveValuesOf(t *testing.T, store content.Store, item content.Content, author uuid.UUID) content.Values
AutosaveValuesOf returns the field values the author's autosave of the item holds.
func CategoryType ¶
CategoryType returns a content type items may be filed under.
func DeclareFields ¶
DeclareFields stores a group on the post type declaring the fields in order, and returns the group holding them.
func DeclareFlexible ¶
DeclareFlexible stores a flexible field named features in the group keyed after the car type and returns it.
func DeclareLayout ¶
DeclareLayout stores a layout under the flexible and returns it.
func DeclareOnType ¶
func DeclareOnType(t *testing.T, types content.TypeStore, typeKey string, f content.Field) content.Field
DeclareOnType stores the field inside the group keyed after the type and returns it.
func DeclareRepeater ¶
DeclareRepeater stores a repeater at the top of the car type inside the group keyed after the type and returns it.
func DeclareSection ¶
DeclareSection stores a section at the top of the car type inside the group keyed after the type and returns it.
func DeclareTypedField ¶
DeclareTypedField stores a text field on the type inside the group keyed after the type.
func DeclareUnder ¶
DeclareUnder stores a text sub field under the parent and returns it.
func DeclaredInside ¶
func DeclaredInside( t *testing.T, types content.TypeStore, parent content.Field, key string, kind content.FieldKind, ) content.Field
DeclaredInside declares a sub field of the kind under the parent and returns it.
func DeclaredInto ¶
DeclaredInto stores one plugin's type, group and field through the registry.
func DeclaredSectionInto ¶
DeclaredSectionInto stores a plugin's group holding a section with one sub field, and returns both fields.
func FieldOn ¶
func FieldOn(t *testing.T, typeKey, key string, kind content.FieldKind, relatesTo string) content.Field
FieldOn returns a field definition ready to declare on the type.
func FieldsGroupOf ¶
FieldsGroupOf returns the group keyed after the type, stored at the type's own location when no group holds the key.
func FileUnder ¶
func FileUnder(t *testing.T, store content.Store, post content.Content, targets ...uuid.UUID) content.Content
FileUnder points the post's categories at the targets and stores it.
func GroupHolding ¶
GroupHolding returns the id of the stored group declaring the key.
func HeldTargets ¶
HeldTargets returns the identities the item's categories value names.
func Holding ¶
func Holding( t *testing.T, store content.Store, title string, author uuid.UUID, values content.Values, ) content.Content
Holding stores a draft post carrying the given field values.
func LocationOf ¶
LocationOf returns a one rule location naming the type.
func MustAutosave ¶
MustAutosave returns an autosave of the post credited to author.
func MustCreate ¶
MustCreate stores a draft post with the given title.
func MustFlexible ¶
MustFlexible returns a flexible sub field ready to stand inside a container.
func MustNest ¶
func MustNest( t *testing.T, store content.Store, parent *content.Content, title string, author uuid.UUID, ) content.Content
MustNest stores a page under the parent and returns it.
func MustSnapshot ¶
MustSnapshot returns a revision of the post credited to author.
func NamedTargets ¶
NamedTargets returns the identities as a relation value stores them.
func ParkValues ¶
func ParkValues(t *testing.T, store content.Store, item content.Content, author uuid.UUID, values content.Values)
ParkValues stores the author's autosave of the item holding the values.
func PointedAtBy ¶
PointedAtBy returns how many published items point at the target through any field.
func Publish ¶
func Publish(t *testing.T, store content.Store, title string, author uuid.UUID, at time.Time) content.Content
Publish stores a post already published at the given time.
func PublishItem ¶
PublishItem takes stored content public and returns it.
func ReadersOn ¶
func ReadersOn(t *testing.T, types content.TypeStore, typeKey, relation string) (content.Group, content.Field)
ReadersOn stores a group on the type holding a backlinks field that reads the named relation, and returns both.
func RegisterCategoryType ¶
RegisterCategoryType stores the category type so posts may point at categories.
func RegisterPageType ¶
RegisterPageType stores the hierarchical page type so pages can nest.
func RelateToCategories ¶
RelateToCategories registers the category type and declares the categories relation on the post type.
func RelationInside ¶
func RelationInside(t *testing.T, types content.TypeStore, parent content.Field, key string) content.Field
RelationInside declares a relation pointing at cars inside the container and returns it.
func RestingTwinOf ¶
RestingTwinOf stores a resting group on car holding a section under the key and returns the section.
func RevisionValuesOf ¶
RevisionValuesOf returns the field values the store holds for the revision.
func RivalOnTruck ¶
RivalOnTruck stores a truck group holding a section under the key, registers truck and returns the group.
func RowsFiledUnder ¶
RowsFiledUnder returns the rows value pointing at every target through the relation inside it.
func RowsPointing ¶
RowsPointing declares a repeater on posts holding a relation that points at categories, and returns the relation.
func RunSiteSettings ¶
RunSiteSettings runs every site setting store case in parallel, each on stores of its own.
func RunUserSettings ¶
RunUserSettings runs every user setting store case in parallel, each on stores of its own.
func SectionChainOnCar ¶
func SectionChainOnCar(t *testing.T, types content.TypeStore, registry *content.Registry, depth int) content.Field
SectionChainOnCar returns the deepest section of a chain nested depth levels under a top section of the car type.
func ServingEverything ¶
ServingEverything stores a group matching every type and returns it.
func StalePage ¶
func StalePage(t *testing.T, parent *content.Content, title string, author uuid.UUID) content.Content
StalePage returns a page built against the type as it nested, filed under the parent.
func StillStored ¶
StillStored reports whether the store still holds the item.
func StoreItem ¶
func StoreItem( t *testing.T, store content.Store, kind content.Type, parent *content.Content, title string, author uuid.UUID, ) content.Content
StoreItem stores an item of the type under the parent and returns it.
func StoredCategory ¶
func StoredCategory(t *testing.T, store content.Store, title string, author uuid.UUID) content.Content
StoredCategory stores one category item and returns it.
func TitlesOf ¶
func TitlesOf(posts []content.ListedItem) []string
TitlesOf returns the titles of the listed items in order.
func TypedHolding ¶
func TypedHolding( t *testing.T, types content.TypeStore, store content.Store, typeKey, title string, author uuid.UUID, values content.Values, ) (content.Content, content.Revision)
TypedHolding stores an item of the type holding the values with a revision holding them too, and returns both.
Types ¶
type Case ¶
Case is one named behaviour every store of its kind shares.
func SiteSettingCases ¶
func SiteSettingCases() []Case
SiteSettingCases returns every site setting store case in a fixed order.
func UserSettingCases ¶
func UserSettingCases() []Case
UserSettingCases returns every user setting store case in a fixed order.
type Factory ¶
Factory returns fresh stores for one case, skipping the case when its engine is out of reach.
type Stores ¶
type Stores struct {
Content content.Store
Types content.TypeStore
SiteSettings content.SiteSettingStore
UserSettings content.UserSettingStore
AddAuthor func(t *testing.T, name string) uuid.UUID
}
Stores is one fresh set of content, type, site setting and user setting stores, holding only the built-in post type.
Source Files
¶
- adopt.go
- autosave.go
- backlinks.go
- content.go
- contenttest.go
- contract_keys.go
- contract_orders.go
- contract_stamps.go
- contract_sweeps.go
- contract_writes.go
- definitions_sweep.go
- field_depth.go
- field_moves.go
- field_moves_values.go
- field_parents.go
- field_sweep.go
- filter.go
- fixtures.go
- frozen_keeps.go
- frozen_relations.go
- frozen_sweeps.go
- groups.go
- groups_recheck.go
- groups_repoint.go
- groups_values.go
- kinds.go
- layout_sweep.go
- list.go
- nesting.go
- origins.go
- paths.go
- published.go
- relations.go
- relations_nested.go
- revisions.go
- settings.go
- site_settings.go
- slugs.go
- subfield_writes.go
- trash.go
- type_fixtures.go
- types.go
- types_fields.go
- types_nesting.go
- user_settings.go
- values.go