mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* feat(EN-420): added page size as a const for each plugin * feat(EN-420): remove pageSize from connector config * feat(EN-420): review all limits according to api docs * ensure pageSize is marked as deprecated * sdk generation * fix: tests * fix: ignore linting error on depreated call * feat: change deprecation message * regenerate openapi & sdk * change message to avoid duplicating the deprecation word * regenerate openapi & sdk * feat: change deprecation message * regenerate openapi & sdk
41 lines
904 B
Go
41 lines
904 B
Go
package connectors
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/formancehq/payments/internal/models"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestCombineConfigs_PluginPrecedence(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
base := models.Config{
|
|
Name: "conn-name",
|
|
PollingPeriod: 10 * time.Minute, // lower than plugin
|
|
}
|
|
|
|
pluginCfg := map[string]any{
|
|
"apiKey": "sk_test",
|
|
"pollingPeriod": "20m0s", // plugin-normalized value should win
|
|
}
|
|
|
|
b, err := combineConfigs(base, pluginCfg)
|
|
require.NoError(t, err)
|
|
|
|
var out map[string]any
|
|
require.NoError(t, json.Unmarshal(b, &out))
|
|
|
|
// Plugin value should take precedence
|
|
assert.Equal(t, "20m0s", out["pollingPeriod"])
|
|
|
|
// Base-only fields should be present
|
|
assert.Equal(t, "conn-name", out["name"])
|
|
|
|
// Plugin specific field preserved
|
|
assert.Equal(t, "sk_test", out["apiKey"])
|
|
}
|