Просмотр исходного кода

test code for blackhole config

v2ray 9 лет назад
Родитель
Сommit
0857fdb0f8
1 измененных файлов с 25 добавлено и 0 удалено
  1. 25 0
      proxy/blackhole/config_json_test.go

+ 25 - 0
proxy/blackhole/config_json_test.go

@@ -0,0 +1,25 @@
+package blackhole_test
+
+import (
+	"encoding/json"
+	"testing"
+
+	. "github.com/v2ray/v2ray-core/proxy/blackhole"
+	"github.com/v2ray/v2ray-core/testing/assert"
+)
+
+func TestHTTPResponseJSON(t *testing.T) {
+	assert := assert.On(t)
+
+	rawJson := `{
+    "response": {
+      "type": "http"
+    }
+  }`
+	config := new(Config)
+	err := json.Unmarshal([]byte(rawJson), config)
+	assert.Error(err).IsNil()
+
+	_, ok := config.Response.(*HTTPResponse)
+	assert.Bool(ok).IsTrue()
+}