Documentation ¶
Overview ¶
Package et stands for Encore Tests and provides a number of functions and tools for writing fully integrated test suites for Encore applications.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OverrideAuthInfo ¶ added in v1.10.1
OverrideAuthInfo overrides the auth information for the current request. Subsequent calls to auth.UserID and auth.Data() within the same request will return the given uid and data, and API calls made from the request will propagate the newly set user info.
Passing in an empty string as the uid results in unsetting the auth information, causing future API calls to behave as if there was no authenticated user.
If the application's auth handler returns custom auth data, two additional requirements exist. First, the data parameter passed to WithContext must be of the same type as the auth handler returns. Second, if the uid argument is not the empty string then data may not be nil. If these requirements are not met, API calls made with these options will not be made and will immediately return a client-side error.
OverrideAuthInfo is not safe for concurrent use with code that invokes auth.UserID or auth.Data() within the same request.
Types ¶
type TopicHelpers ¶
type TopicHelpers[T any] interface { // PublishedMessages returns a slice of all messages published during this test on this topic. PublishedMessages() []T }
TopicHelpers provides functions for interacting with the backing topic implementation during unit tests. It is designed to help test code that uses the pubsub.Topic
Note all functions on this TopicHelpers are scoped to the current test and will only impact and observe state from the current test