test(app): update `OnGetDynamicSetting` method signature to use `definition.PluginSettingDefinitionItem`

* Changed the method signature in `emptyAPIImpl` and `mockAPI` to accept a callback that returns `definition.PluginSettingDefinitionItem`.
* This improves type safety and aligns with the updated plugin API requirements.
This commit is contained in:
qianlifeng 2025-07-30 21:33:36 +08:00
parent 62fdd3b7c7
commit 096ee65d18
No known key found for this signature in database
2 changed files with 8 additions and 5 deletions

View File

@ -5,6 +5,7 @@ import (
"testing"
"wox/common"
"wox/plugin"
"wox/setting/definition"
"wox/util"
"github.com/stretchr/testify/require"
@ -13,7 +14,7 @@ import (
type emptyAPIImpl struct {
}
func (e emptyAPIImpl) OnGetDynamicSetting(ctx context.Context, callback func(key string) string) {
func (e emptyAPIImpl) OnGetDynamicSetting(context.Context, func(string) definition.PluginSettingDefinitionItem) {
}
func (e emptyAPIImpl) ChangeQuery(ctx context.Context, query common.PlainQuery) {

View File

@ -7,6 +7,7 @@ import (
"testing"
"wox/common"
"wox/plugin"
"wox/setting/definition"
"github.com/stretchr/testify/assert"
)
@ -263,10 +264,11 @@ func (m *mockAPI) RestartApp(ctx context.Context)
func (m *mockAPI) ReloadPlugin(ctx context.Context, pluginId string) {}
func (m *mockAPI) RemovePlugin(ctx context.Context, pluginId string) {}
func (m *mockAPI) OnSettingChanged(ctx context.Context, callback func(key string, value string)) {}
func (m *mockAPI) OnGetDynamicSetting(ctx context.Context, callback func(key string) string) {}
func (m *mockAPI) OnDeepLink(ctx context.Context, callback func(arguments map[string]string)) {}
func (m *mockAPI) OnUnload(ctx context.Context, callback func()) {}
func (m *mockAPI) RegisterQueryCommands(ctx context.Context, commands []plugin.MetadataCommand) {}
func (m *mockAPI) OnGetDynamicSetting(context.Context, func(string) definition.PluginSettingDefinitionItem) {
}
func (m *mockAPI) OnDeepLink(ctx context.Context, callback func(arguments map[string]string)) {}
func (m *mockAPI) OnUnload(ctx context.Context, callback func()) {}
func (m *mockAPI) RegisterQueryCommands(ctx context.Context, commands []plugin.MetadataCommand) {}
func (m *mockAPI) AIChatStream(ctx context.Context, model common.Model, conversations []common.Conversation, options common.ChatOptions, callback common.ChatStreamFunc) error {
return nil
}