navidrome/plugins/pdk/go/host/nd_host_config_stub.go
Deluan Quintão 5a5311a9c0
fix(plugins): make generated mock stubs nil-safe for nilable returns (#5909)
The ndpgen mock accessors asserted return types unconditionally, so a plugin
test using Return(nil, ...) — the natural way to model an empty result or a
pagination terminal page — panicked on the untyped-nil type assertion instead
of returning the zero value. Guard pointer, slice, map and any returns in both
the host-service client stubs and the PDK stub, and regenerate.
2026-08-08 21:57:44 -04:00

79 lines
2.2 KiB
Go

// Code generated by ndpgen. DO NOT EDIT.
//
// This file contains mock implementations for non-WASM builds.
// These mocks allow IDE support, compilation, and unit testing on non-WASM platforms.
// Plugin authors can use the exported mock instances to set expectations in tests.
//
//go:build !wasip1
package host
import (
"github.com/stretchr/testify/mock"
)
// mockConfigService is the mock implementation for testing.
type mockConfigService struct {
mock.Mock
}
// ConfigMock is the auto-instantiated mock instance for testing.
// Use this to set expectations: host.ConfigMock.On("MethodName", args...).Return(values...)
var ConfigMock = &mockConfigService{}
// Get is the mock method for ConfigGet.
func (m *mockConfigService) Get(key string) (string, bool) {
args := m.Called(key)
return args.String(0), args.Bool(1)
}
// ConfigGet delegates to the mock instance.
// Get retrieves a configuration value as a string.
//
// Parameters:
// - key: The configuration key
//
// Returns the value and whether the key exists.
func ConfigGet(key string) (string, bool) {
return ConfigMock.Get(key)
}
// GetInt is the mock method for ConfigGetInt.
func (m *mockConfigService) GetInt(key string) (int64, bool) {
args := m.Called(key)
return args.Get(0).(int64), args.Bool(1)
}
// ConfigGetInt delegates to the mock instance.
// GetInt retrieves a configuration value as an integer.
//
// Parameters:
// - key: The configuration key
//
// Returns the value and whether the key exists. If the key exists but the
// value cannot be parsed as an integer, exists will be false.
func ConfigGetInt(key string) (int64, bool) {
return ConfigMock.GetInt(key)
}
// Keys is the mock method for ConfigKeys.
func (m *mockConfigService) Keys(prefix string) []string {
args := m.Called(prefix)
var r0 []string
if v := args.Get(0); v != nil {
r0 = v.([]string)
}
return r0
}
// ConfigKeys delegates to the mock instance.
// Keys returns configuration keys matching the given prefix.
//
// Parameters:
// - prefix: Key prefix to filter by. If empty, returns all keys.
//
// Returns a sorted slice of matching configuration keys.
func ConfigKeys(prefix string) []string {
return ConfigMock.Keys(prefix)
}