File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,38 @@ func TestScenario(t *testing.T) {
5151 AssertOn (t , makeQueryHandler )
5252 })
5353
54+ t .Run ("returns the expected User by its email after it has been changed" , func (t * testing.T ) {
55+ query .
56+ Scenario [user.GetByEmail , user.View , * user.GetByEmailHandler ]().
57+ Given (event.Persisted {
58+ StreamID : event .StreamID (id .String ()),
59+ Version : 1 ,
60+ Envelope : event .ToEnvelope (& user.Event {
61+ ID : id ,
62+ RecordTime : before ,
63+ Kind : & user.WasCreated {
64+ FirstName : expected .FirstName ,
65+ LastName : expected .LastName ,
66+ BirthDate : expected .BirthDate ,
67+ 68+ },
69+ }),
70+ }, event.Persisted {
71+ StreamID : event .StreamID (id .String ()),
72+ Version : 2 ,
73+ Envelope : event .ToEnvelope (& user.Event {
74+ ID : id ,
75+ RecordTime : before ,
76+ Kind : & user.EmailWasUpdated {
77+ Email : expected .Email ,
78+ },
79+ }),
80+ }).
81+ When (query .ToEnvelope (user .GetByEmail (expected .Email ))).
82+ Then (expected ).
83+ AssertOn (t , makeQueryHandler )
84+ })
85+
5486 t .Run ("returns user.ErrNotFound if the requested User does not exist" , func (t * testing.T ) {
5587 query .
5688 Scenario [user.GetByEmail , user.View , * user.GetByEmailHandler ]().
You can’t perform that action at this time.
0 commit comments