add Module.Lifecycle getter method
This commit is contained in:
@@ -64,3 +64,16 @@ func TestModule(t *testing.T) {
|
||||
mod.loaded = true
|
||||
assert.NotPanics(func() { mod.RequireLoaded() }, "expected RequireLoaded to not panic when module is loaded")
|
||||
}
|
||||
|
||||
func TestModule_Lifecycle(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
// Create a module and check its lifecycle
|
||||
mod := NewModule("testModule", ModuleOpts{})
|
||||
assert.Nil(mod.Lifecycle(), "expected Lifecycle to return nil when module is not part of a lifecycle")
|
||||
|
||||
// Create a lifecycle and set it to the module
|
||||
lifecycle := &Lifecycle{}
|
||||
mod.lifecycle = lifecycle
|
||||
assert.Equal(lifecycle, mod.Lifecycle(), "expected Lifecycle to return the correct lifecycle")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user