Documentation ¶
Index ¶
- type ConversationFactory
- func (f *ConversationFactory) NewTestConversation(localAccount *gtsmodel.Account, nowOffset time.Duration) *gtsmodel.Conversation
- func (f *ConversationFactory) NewTestStatus(localAccount *gtsmodel.Account, threadID string, nowOffset time.Duration, ...) *gtsmodel.Status
- func (f *ConversationFactory) NewULID(offset time.Duration) string
- func (f *ConversationFactory) SetLastStatus(conversation *gtsmodel.Conversation, status *gtsmodel.Status) *gtsmodel.Conversation
- func (f *ConversationFactory) SetupSuite(suite testSuite)
- func (f *ConversationFactory) SetupTest(db db.DB)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConversationFactory ¶
type ConversationFactory struct { // TestStart is the timestamp used as a base for timestamps and ULIDs in any given test. TestStart time.Time // contains filtered or unexported fields }
ConversationFactory can be embedded or included by test suites that want to generate statuses and conversations.
func (*ConversationFactory) NewTestConversation ¶
func (f *ConversationFactory) NewTestConversation(localAccount *gtsmodel.Account, nowOffset time.Duration) *gtsmodel.Conversation
NewTestConversation creates a new status and adds it to a new unread conversation, returning the conversation.
func (*ConversationFactory) NewTestStatus ¶
func (*ConversationFactory) NewULID ¶
func (f *ConversationFactory) NewULID(offset time.Duration) string
NewULID is a version of id.NewULID that uses the test start time and an offset instead of the real time.
func (*ConversationFactory) SetLastStatus ¶
func (f *ConversationFactory) SetLastStatus(conversation *gtsmodel.Conversation, status *gtsmodel.Status) *gtsmodel.Conversation
SetLastStatus sets an already stored status as the last status of a new or already stored conversation, and returns the updated conversation.
func (*ConversationFactory) SetupSuite ¶
func (f *ConversationFactory) SetupSuite(suite testSuite)
SetupSuite should be called by the SetupSuite of test suites that use this mixin.
func (*ConversationFactory) SetupTest ¶
func (f *ConversationFactory) SetupTest(db db.DB)
SetupTest should be called by the SetupTest of test suites that use this mixin.