Files
CrimsonandGitHub 61cae8af0a chore: Move all CE plugins to own go modules (#780)
* Move all public connectors to ce/plugins

* Update tooling to account for new go modules under ce

* Ensure we test all CE plugins in CI

* Move Dummypay to ce/plugins for simplicity's sake in the generation scripts

* Use versioned pkg/domain in plugins

* Ensure that renovate updates all CE plugins in a single PR when pkg/domain tags are pushed to github

* Ensure Justfile commands work over all CE plugins

* Copy ce plugin go.mods in dev.Dockerfile

* Only add a go.mod for new plugins if they are ce

* Ensure generated generic client structs are named correctly for submodule

* Add coverprofile for each ce plugin

* Add set -e for Justfile for loops over plugins

* Infer go version from flake.nix in connector template tool
2026-07-01 14:53:02 +00:00

48 lines
988 B
Go

package generic
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestUnmarshalAndValidateConfig(t *testing.T) {
t.Parallel()
tests := []struct {
name string
payload []byte
expected Config
expectError bool
}{
{
name: "Valid Config",
payload: []byte(`{"apiKey":"sk_test","endpoint":"https://api.generic.example"}`),
expected: Config{
APIKey: "sk_test",
Endpoint: "https://api.generic.example",
},
expectError: false,
},
{
name: "Missing Required Fields",
payload: []byte(`{"apiKey":"sk_test"}`),
expected: Config{},
expectError: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
config, err := unmarshalAndValidateConfig(tt.payload)
if tt.expectError {
require.Error(t, err)
} else {
require.NoError(t, err)
assert.Equal(t, tt.expected, config)
}
})
}
}