Skip to content

Commit

Permalink
Updated lifecycle test
Browse files Browse the repository at this point in the history
  • Loading branch information
stewartbzillow committed Dec 19, 2024
1 parent f28af6a commit 96dd00c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func Test_LifecycleChainedHooksAreCalled(t *testing.T) {

lh := ChainLifecycleHooks(hooks1, hooks2)

lh.PreProcessing(context.Background(), LifecyclePreProcessingMeta{})
_, err := lh.PreProcessing(context.Background(), LifecyclePreProcessingMeta{})
require.NoError(t, err)
require.Equal(t, 1, lhState["hooks1-pre-processing"])
require.Equal(t, 1, lhState["hooks2-pre-processing"])
require.Equal(t, 0, lhState["hooks1-post-processing"])
Expand All @@ -88,7 +89,8 @@ func Test_LifecycleChainedHooksAreCalled(t *testing.T) {
require.Equal(t, 0, lhState["hooks1-post-read-immediate"])
require.Equal(t, 0, lhState["hooks2-post-read-immediate"])

lh.PostProcessing(context.Background(), LifecyclePostProcessingMeta{})
err = lh.PostProcessing(context.Background(), LifecyclePostProcessingMeta{})
require.NoError(t, err)
require.Equal(t, 1, lhState["hooks1-pre-processing"])
require.Equal(t, 1, lhState["hooks2-pre-processing"])
require.Equal(t, 1, lhState["hooks1-post-processing"])
Expand All @@ -106,7 +108,8 @@ func Test_LifecycleChainedHooksAreCalled(t *testing.T) {
require.Equal(t, 0, lhState["hooks1-post-read-immediate"])
require.Equal(t, 0, lhState["hooks2-post-read-immediate"])

lh.PostRead(context.Background(), LifecyclePostReadMeta{})
_, err = lh.PostRead(context.Background(), LifecyclePostReadMeta{})
require.NoError(t, err)
require.Equal(t, 1, lhState["hooks1-pre-processing"])
require.Equal(t, 1, lhState["hooks2-pre-processing"])
require.Equal(t, 1, lhState["hooks1-post-processing"])
Expand All @@ -124,7 +127,8 @@ func Test_LifecycleChainedHooksAreCalled(t *testing.T) {
require.Equal(t, 0, lhState["hooks1-post-read-immediate"])
require.Equal(t, 0, lhState["hooks2-post-read-immediate"])

lh.PostAck(context.Background(), LifecyclePostAckMeta{})
err = lh.PostAck(context.Background(), LifecyclePostAckMeta{})
require.NoError(t, err)
require.Equal(t, 1, lhState["hooks1-pre-processing"])
require.Equal(t, 1, lhState["hooks2-pre-processing"])
require.Equal(t, 1, lhState["hooks1-post-processing"])
Expand All @@ -140,7 +144,8 @@ func Test_LifecycleChainedHooksAreCalled(t *testing.T) {
require.Equal(t, 0, lhState["hooks1-post-read-immediate"])
require.Equal(t, 0, lhState["hooks2-post-read-immediate"])

lh.PreWrite(context.Background(), LifecyclePreWriteMeta{})
_, err = lh.PreWrite(context.Background(), LifecyclePreWriteMeta{})
require.NoError(t, err)
require.Equal(t, 1, lhState["hooks1-pre-processing"])
require.Equal(t, 1, lhState["hooks2-pre-processing"])
require.Equal(t, 1, lhState["hooks1-post-processing"])
Expand Down

0 comments on commit 96dd00c

Please sign in to comment.