MCPcopy
hub / github.com/dosco/graphjin / TestCodeSQLRawTableMutationRootsUnavailable

Function TestCodeSQLRawTableMutationRootsUnavailable

serv/codesql_test.go:657–688  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

655}
656
657func TestCodeSQLRawTableMutationRootsUnavailable(t *testing.T) {
658 source := t.TempDir()
659 writeTestFile(t, filepath.Join(source, "main.go"), `package main
660
661func Blocked() {}
662`)
663
664 conf := &Config{
665 Core: Core{
666 DisableAllowList: true,
667 Sources: []core.SourceConfig{
668 {Name: "code", Kind: "code", Path: source},
669 },
670 },
671 Serv: Serv{
672 ConfigPath: filepath.Join(t.TempDir(), "config"),
673 MCP: MCPConfig{Disable: true},
674 },
675 }
676 s, err := newGraphJinService(conf, nil)
677 if err != nil {
678 t.Fatal(err)
679 }
680 defer closeTestService(s)
681
682 _, err = s.gj.GraphQL(context.Background(), `mutation {
683 code_files(insert: { path: "x.go", abs_path: "x.go", language: "go", hash: "x", size: 1, mtime_unix: 1, indexed_at: "now" }) { id }
684 }`, nil, nil)
685 if err == nil || !strings.Contains(err.Error(), "blocked") {
686 t.Fatalf("direct derived mutation err = %v, want blocked raw CodeSQL root", err)
687 }
688}
689
690func TestCodeSQLWatcherInvalidatesResponseCache(t *testing.T) {
691 source := t.TempDir()

Callers

nothing calls this directly

Calls 5

writeTestFileFunction · 0.85
newGraphJinServiceFunction · 0.85
closeTestServiceFunction · 0.85
ErrorMethod · 0.65
GraphQLMethod · 0.45

Tested by

no test coverage detected