Skip to content

Commit

Permalink
Added unit test on Closing BaseModule.
Browse files Browse the repository at this point in the history
  • Loading branch information
vvuwei committed Sep 11, 2023
1 parent b3594bd commit f49f741
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/modules/baseModule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,21 @@ func TestBaseModule_AttachToOnExistingChannel(t *testing.T) {
_, ok = <-input.Listen() // TODO-DISCUSS
assert.False(t, ok)
}

func TestBaseModule_CloseSuccessfullyCloseInputChannels(t *testing.T) {
//bmSrc := &BaseModule{Outputs: sync.NewMap[string, *Output]()}

Check failure on line 94 in pkg/modules/baseModule_test.go

View workflow job for this annotation

GitHub Actions / lint

commentFormatting: put a space between `//` and comment text (gocritic)
bmDst := &BaseModule{Inputs: sync.NewMap[string, *Input]()}
channelName := "data"

//bmSrc.Outputs.Set(channelName, NewOutput(channelName))

Check failure on line 98 in pkg/modules/baseModule_test.go

View workflow job for this annotation

GitHub Actions / lint

commentFormatting: put a space between `//` and comment text (gocritic)
bmDst.Inputs.Set(channelName, NewInput(channelName))

input, err := bmDst.Input(channelName)
assert.NoError(t, err)

err = bmDst.Close()
assert.NoError(t, err)

_, ok := <-input.Listen() // TODO-DISCUSS
assert.False(t, ok)
}

0 comments on commit f49f741

Please sign in to comment.