@opensoha/contracts 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -177,3 +177,33 @@ func TestApprovalScopeKeepsMapCompatibility(t *testing.T) {
177
177
  t.Fatalf("resolved scope lost: %s", encoded)
178
178
  }
179
179
  }
180
+
181
+ func TestNetworkProxyInputsRemainInGoSDK(t *testing.T) {
182
+ for _, input := range []struct {
183
+ raw string
184
+ value any
185
+ }{
186
+ {`{"id":"proxy-a","name":"Proxy A","engine":"mihomo","host":"host-a"}`, &NetworkProxyInstanceInput{}},
187
+ {`{"expectedRevision":3,"enabled":false,"content":"mode: rule"}`, &NetworkProxyConfigurationInput{}},
188
+ } {
189
+ if err := json.Unmarshal([]byte(input.raw), input.value); err != nil {
190
+ t.Fatal(err)
191
+ }
192
+ encoded, err := json.Marshal(input.value)
193
+ if err != nil {
194
+ t.Fatal(err)
195
+ }
196
+ var before, after map[string]any
197
+ if err := json.Unmarshal([]byte(input.raw), &before); err != nil {
198
+ t.Fatal(err)
199
+ }
200
+ if err := json.Unmarshal(encoded, &after); err != nil {
201
+ t.Fatal(err)
202
+ }
203
+ for name, value := range before {
204
+ if after[name] != value {
205
+ t.Fatalf("%s changed during round trip: %s", name, encoded)
206
+ }
207
+ }
208
+ }
209
+ }