Documentation ¶
Index ¶
- type AllDeleter
- type AllDeleterSubject
- type AllFinder
- type AllFinderSubject
- type ByIDDeleter
- type ByIDDeleterSubject
- type ByIDFinder
- type ByIDFinderSubject
- type Creator
- type CreatorSubject
- type Deleter
- type DeleterSubject
- type Finder
- type FinderSubject
- type OnePhaseCommitProtocol
- type OnePhaseCommitProtocolSubject
- type Purger
- type PurgerSubject
- type QueryMany
- type QueryManySubject
- type QueryOne
- type QueryOneSubject
- type Suite
- type SuiteSubject
- type Updater
- type UpdaterSubject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllDeleter ¶
type AllDeleter[Entity, ID any] func(testing.TB) AllDeleterSubject[Entity, ID]
func (AllDeleter[Entity, ID]) Benchmark ¶
func (c AllDeleter[Entity, ID]) Benchmark(b *testing.B)
func (AllDeleter[Entity, ID]) Name ¶ added in v0.136.0
func (c AllDeleter[Entity, ID]) Name() string
func (AllDeleter[Entity, ID]) Spec ¶
func (c AllDeleter[Entity, ID]) Spec(s *testcase.Spec)
func (AllDeleter[Entity, ID]) Test ¶
func (c AllDeleter[Entity, ID]) Test(t *testing.T)
type AllDeleterSubject ¶
type AllFinder ¶
type AllFinder[Entity, ID any] func(testing.TB) AllFinderSubject[Entity, ID]
AllFinder can return business entities from a given resource that implement it's test The "EntityTypeName" is an Empty struct for the specific entity (struct) type that should be returned.
NewEntityForTest used only for testing and should not be provided outside of testing
type AllFinderSubject ¶
type ByIDDeleter ¶
type ByIDDeleter[Entity, ID any] func(testing.TB) ByIDDeleterSubject[Entity, ID]
func (ByIDDeleter[Entity, ID]) Benchmark ¶
func (c ByIDDeleter[Entity, ID]) Benchmark(b *testing.B)
func (ByIDDeleter[Entity, ID]) Name ¶ added in v0.136.0
func (c ByIDDeleter[Entity, ID]) Name() string
func (ByIDDeleter[Entity, ID]) Spec ¶
func (c ByIDDeleter[Entity, ID]) Spec(s *testcase.Spec)
func (ByIDDeleter[Entity, ID]) Test ¶
func (c ByIDDeleter[Entity, ID]) Test(t *testing.T)
type ByIDDeleterSubject ¶
type ByIDDeleterSubject[Entity, ID any] struct { Resource spechelper.CRD[Entity, ID] MakeContext func() context.Context MakeEntity func() Entity }
type ByIDFinder ¶
type ByIDFinder[Entity, ID any] func(testing.TB) ByIDFinderSubject[Entity, ID]
func (ByIDFinder[Entity, ID]) Benchmark ¶
func (c ByIDFinder[Entity, ID]) Benchmark(b *testing.B)
func (ByIDFinder[Entity, ID]) Name ¶
func (c ByIDFinder[Entity, ID]) Name() string
func (ByIDFinder[Entity, ID]) Spec ¶
func (c ByIDFinder[Entity, ID]) Spec(s *testcase.Spec)
func (ByIDFinder[Entity, ID]) Test ¶
func (c ByIDFinder[Entity, ID]) Test(t *testing.T)
type ByIDFinderSubject ¶
type ByIDFinderSubject[Entity, ID any] struct { Resource spechelper.CRD[Entity, ID] MakeContext func() context.Context MakeEntity func() Entity }
type CreatorSubject ¶
type CreatorSubject[Entity, ID any] struct { Resource spechelper.CRD[Entity, ID] MakeContext func() context.Context MakeEntity func() Entity // SupportIDReuse is an optional configuration value that tells the contract // that recreating an entity with an ID which belongs to a previously deleted entity is accepted. SupportIDReuse bool // SupportRecreate is an optional configuration value that tells the contract // that deleting an Entity then recreating it with the same values is supported by the Creator. SupportRecreate bool }
type DeleterSubject ¶
type DeleterSubject[Entity, ID any] struct { Resource interface { spechelper.CRD[Entity, ID] crud.AllDeleter } MakeContext func() context.Context MakeEntity func() Entity }
type FinderSubject ¶
type OnePhaseCommitProtocol ¶
type OnePhaseCommitProtocol[Entity, ID any] func(testing.TB) OnePhaseCommitProtocolSubject[Entity, ID]
func (OnePhaseCommitProtocol[Entity, ID]) Benchmark ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Benchmark(b *testing.B)
func (OnePhaseCommitProtocol[Entity, ID]) Name ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Name() string
func (OnePhaseCommitProtocol[Entity, ID]) Spec ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Spec(s *testcase.Spec)
func (OnePhaseCommitProtocol[Entity, ID]) Test ¶
func (c OnePhaseCommitProtocol[Entity, ID]) Test(t *testing.T)
type OnePhaseCommitProtocolSubject ¶
type OnePhaseCommitProtocolSubject[Entity, ID any] struct { Resource spechelper.CRD[Entity, ID] CommitManager comproto.OnePhaseCommitProtocol MakeContext func() context.Context MakeEntity func() Entity }
type PurgerSubject ¶
type QueryManySubject ¶
type QueryManySubject[Entity, ID any] struct { // Resource is the resource that can contain entities. Resource spechelper.CRD[Entity, ID] // Query is the function that knows how to execute a query that will match MakeIncludedEntity. // // QueryManyFunc is the generic representation of a query that meant to find many result. // It is really similar to resources.Finder#FindAll, // with the exception that the closure meant to know the query method name on the subject // and the inputs it requires. Query func(ctx context.Context) iterators.Iterator[Entity] MakeContext func() context.Context // MakeIncludedEntity must return an entity that is matched by the QueryManyFunc MakeIncludedEntity func() Entity // MakeExcludedEntity [OPTIONAL] is an optional property, // that could be used ensure the query returns only the expected values. MakeExcludedEntity func() Entity // Specify allow further specification describing for a given QueryOne query function. // If none specified, this field will be ignored Specify func(testing.TB) }
type QueryOneSubject ¶
type QueryOneSubject[Entity, ID any] struct { // Resource is the resource that can contain entities. Resource spechelper.CRD[Entity, ID] // Name is the name of the test subject QueryOneFunc method of this contract specification. Name string // Query takes an entity value and returns with a closure that has the knowledge about how to query resource to find passed entity. // // By convention, any preparation action that affect the resource must take place prior to returning the closure. // The QueryOneFunc closure should only have the Method call with the already mapped values. // Query will be evaluated in the beginning of the testing, // and executed after all the test Context preparation is done. // // The func signature for Query is the generic representation of a query that meant to find one result. // It is really similar to resources.Finder#FindByID, // with the exception that the closure meant to know the query method name on the subject and the inputs it requires. Query func(ctx context.Context, ent Entity) (_ Entity, found bool, _ error) MakeContext func() context.Context MakeEntity func() Entity // Specify allow further specification describing for a given QueryOne query function. // If none specified, this field will be ignored Specify func(testing.TB) }
type SuiteSubject ¶ added in v0.136.0
type Updater ¶
type Updater[Entity, ID any] func(testing.TB) UpdaterSubject[Entity, ID]
Updater will request an update for a wrapped entity object in the Resource
type UpdaterSubject ¶
type UpdaterSubject[Entity, ID any] struct { Resource updaterSubjectResource[Entity, ID] MakeContext func() context.Context MakeEntity func() Entity // ChangeEntity is an optional configuration field // to express what Entity fields are allowed to be changed by the user of the Updater. // For example, if the changed Entity field is ignored by the Update method, // you can match this by not changing the Entity field as part of the ChangeEntity function. ChangeEntity func(*Entity) }
Click to show internal directories.
Click to hide internal directories.