Ai
1 Star 0 Fork 0

idsutong/gqlgen

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
context_field_test.go 624 Bytes
一键复制 编辑 原始数据 按行查看 历史
Adam 提交于 2020-02-17 07:27 +08:00 . bump to gqlparser v2
package graphql
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"github.com/vektah/gqlparser/v2/ast"
)
func TestGetResolverContext(t *testing.T) {
require.Nil(t, GetFieldContext(context.Background()))
rc := &FieldContext{}
require.Equal(t, rc, GetFieldContext(WithFieldContext(context.Background(), rc)))
}
func testContext(sel ast.SelectionSet) context.Context {
ctx := context.Background()
rqCtx := &OperationContext{}
ctx = WithOperationContext(ctx, rqCtx)
root := &FieldContext{
Field: CollectedField{
Selections: sel,
},
}
ctx = WithFieldContext(ctx, root)
return ctx
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/idsutong/gqlgen.git
git@gitee.com:idsutong/gqlgen.git
idsutong
gqlgen
gqlgen
master

搜索帮助