43 lines
1.1 KiB
Cheetah
43 lines
1.1 KiB
Cheetah
|
|
// 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 PDKMock instance to set expectations in tests.
|
||
|
|
//
|
||
|
|
//go:build !wasip1
|
||
|
|
|
||
|
|
package pdk
|
||
|
|
|
||
|
|
import "github.com/stretchr/testify/mock"
|
||
|
|
|
||
|
|
// mockPDK is the mock implementation for testing PDK functions.
|
||
|
|
type mockPDK struct {
|
||
|
|
mock.Mock
|
||
|
|
}
|
||
|
|
|
||
|
|
// PDKMock is the auto-instantiated mock instance for testing.
|
||
|
|
// Use this to set expectations: pdk.PDKMock.On("GetConfig", "key").Return("value", true)
|
||
|
|
var PDKMock = &mockPDK{}
|
||
|
|
|
||
|
|
// ResetMock resets the mock to its initial state.
|
||
|
|
// Call this in test setup/teardown to ensure clean state between tests.
|
||
|
|
func ResetMock() {
|
||
|
|
PDKMock = &mockPDK{}
|
||
|
|
}
|
||
|
|
|
||
|
|
// Functions
|
||
|
|
{{- range .Functions}}
|
||
|
|
|
||
|
|
{{- if .Doc}}
|
||
|
|
// {{.Name}} {{firstSentence .Doc}}
|
||
|
|
{{- end}}
|
||
|
|
func {{.Name}}({{paramList .Params}}){{returnList .Returns}} {
|
||
|
|
{{- if .Returns}}
|
||
|
|
args := PDKMock.Called({{argList .Params}})
|
||
|
|
return {{mockReturns .Returns}}
|
||
|
|
{{- else}}
|
||
|
|
PDKMock.Called({{argList .Params}})
|
||
|
|
{{- end}}
|
||
|
|
}
|
||
|
|
{{- end}}
|