diff --git a/pkg/browser/service_test.go b/pkg/browser/service_test.go index 9565c61..c025b5d 100644 --- a/pkg/browser/service_test.go +++ b/pkg/browser/service_test.go @@ -3,10 +3,9 @@ package browser import ( "context" - "errors" + core "dappco.re/go/core" "testing" - core "dappco.re/go/core" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -58,7 +57,7 @@ func TestTaskOpenURL_Good(t *testing.T) { } func TestTaskOpenURL_Bad_PlatformError(t *testing.T) { - mp := &mockPlatform{urlErr: errors.New("browser not found")} + mp := &mockPlatform{urlErr: core.NewError("browser not found")} _, c := newTestBrowserService(t, mp) r := c.Action("browser.openURL").Run(context.Background(), core.NewOptions( @@ -79,7 +78,7 @@ func TestTaskOpenFile_Good(t *testing.T) { } func TestTaskOpenFile_Bad_PlatformError(t *testing.T) { - mp := &mockPlatform{fileErr: errors.New("file not found")} + mp := &mockPlatform{fileErr: core.NewError("file not found")} _, c := newTestBrowserService(t, mp) r := c.Action("browser.openFile").Run(context.Background(), core.NewOptions( diff --git a/pkg/display/display_test.go b/pkg/display/display_test.go index fe99925..6afd85b 100644 --- a/pkg/display/display_test.go +++ b/pkg/display/display_test.go @@ -3,7 +3,6 @@ package display import ( "context" "os" - "path/filepath" "testing" core "dappco.re/go/core" @@ -437,8 +436,8 @@ func TestWSEventManager_Good(t *testing.T) { func TestLoadConfig_Good(t *testing.T) { // Create temp config file dir := t.TempDir() - cfgPath := filepath.Join(dir, ".core", "gui", "config.yaml") - require.NoError(t, os.MkdirAll(filepath.Dir(cfgPath), 0o755)) + cfgPath := core.JoinPath(dir, ".core", "gui", "config.yaml") + require.NoError(t, os.MkdirAll(core.PathDir(cfgPath), 0o755)) require.NoError(t, os.WriteFile(cfgPath, []byte(` window: default_width: 1280 @@ -460,7 +459,7 @@ menu: func TestLoadConfig_Bad_MissingFile(t *testing.T) { s, _ := New() - s.loadConfigFrom(filepath.Join(t.TempDir(), "nonexistent.yaml")) + s.loadConfigFrom(core.JoinPath(t.TempDir(), "nonexistent.yaml")) // Should not panic, configData stays at empty defaults assert.Empty(t, s.configData["window"]) @@ -470,7 +469,7 @@ func TestLoadConfig_Bad_MissingFile(t *testing.T) { func TestHandleConfigTask_Persists_Good(t *testing.T) { dir := t.TempDir() - cfgPath := filepath.Join(dir, "config.yaml") + cfgPath := core.JoinPath(dir, "config.yaml") s, _ := New() s.loadConfigFrom(cfgPath) // Creates empty config (file doesn't exist yet) diff --git a/pkg/notification/service_test.go b/pkg/notification/service_test.go index 1ee6e23..88f4ee6 100644 --- a/pkg/notification/service_test.go +++ b/pkg/notification/service_test.go @@ -3,10 +3,9 @@ package notification import ( "context" - "errors" + core "dappco.re/go/core" "testing" - core "dappco.re/go/core" "forge.lthn.ai/core/gui/pkg/dialog" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -86,7 +85,7 @@ func TestTaskSend_Good(t *testing.T) { func TestTaskSend_Fallback_Good(t *testing.T) { // Platform fails -> falls back to dialog via IPC - mockNotify := &mockPlatform{sendErr: errors.New("no permission")} + mockNotify := &mockPlatform{sendErr: core.NewError("no permission")} mockDlg := &mockDialogPlatform{} c := core.New( core.WithService(dialog.Register(mockDlg)), @@ -135,7 +134,7 @@ func TestTaskRevokePermission_Good(t *testing.T) { func TestTaskRevokePermission_Bad(t *testing.T) { mock, c := newTestService(t) - mock.revokeErr = errors.New("cannot revoke") + mock.revokeErr = core.NewError("cannot revoke") r := c.Action("notification.revokePermission").Run(context.Background(), core.NewOptions()) assert.False(t, r.OK) } @@ -250,7 +249,7 @@ func TestQueryPermission_Bad(t *testing.T) { func TestQueryPermission_Ugly(t *testing.T) { // Platform returns error — QUERY returns OK=false (framework does not propagate Value for failed queries) - mock := &mockPlatform{permErr: errors.New("platform error")} + mock := &mockPlatform{permErr: core.NewError("platform error")} c := core.New( core.WithService(Register(mock)), core.WithServiceLock(), diff --git a/pkg/window/persistence_test.go b/pkg/window/persistence_test.go index eed02de..d438240 100644 --- a/pkg/window/persistence_test.go +++ b/pkg/window/persistence_test.go @@ -3,7 +3,7 @@ package window import ( "os" - "path/filepath" + core "dappco.re/go/core" "testing" "time" @@ -181,7 +181,7 @@ func TestStateManager_Persistence_Good(t *testing.T) { func TestStateManager_SetPath_Good(t *testing.T) { dir := t.TempDir() - path := filepath.Join(dir, "custom", "window-state.json") + path := core.JoinPath(dir, "custom", "window-state.json") sm := NewStateManagerWithDir(dir) sm.SetPath(path)