package core_test import ( "testing" . "forge.lthn.ai/core/go/pkg/core" "github.com/stretchr/testify/assert" ) // --- New --- func TestNew_Good(t *testing.T) { c := New() assert.NotNil(t, c) } func TestNew_WithOptions_Good(t *testing.T) { c := New(Options{{K: "name", V: "myapp"}}) assert.NotNil(t, c) assert.Equal(t, "myapp", c.App().Name) } func TestNew_WithOptions_Bad(t *testing.T) { // Empty options — should still create a valid Core c := New(Options{}) assert.NotNil(t, c) } // --- Accessors --- func TestAccessors_Good(t *testing.T) { c := New() assert.NotNil(t, c.App()) assert.NotNil(t, c.Data()) assert.NotNil(t, c.Drive()) assert.NotNil(t, c.Fs()) assert.NotNil(t, c.Config()) assert.NotNil(t, c.Error()) assert.NotNil(t, c.Log()) assert.NotNil(t, c.Cli()) assert.NotNil(t, c.IPC()) assert.NotNil(t, c.I18n()) assert.Equal(t, c, c.Core()) } func TestOptions_Accessor_Good(t *testing.T) { c := New(Options{ {K: "name", V: "testapp"}, {K: "port", V: 8080}, {K: "debug", V: true}, }) opts := c.Options() assert.NotNil(t, opts) assert.Equal(t, "testapp", opts.String("name")) assert.Equal(t, 8080, opts.Int("port")) assert.True(t, opts.Bool("debug")) } func TestOptions_Accessor_Nil(t *testing.T) { c := New() // No options passed — Options() returns nil assert.Nil(t, c.Options()) }