-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5216c6
commit aa21960
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,7 @@ var ( | |
"updateNode": {}, | ||
"valuesNode": {}, | ||
"viewNode": {}, | ||
"lensNode": {}, | ||
} | ||
) | ||
|
||
|
87 changes: 87 additions & 0 deletions
87
tests/integration/explain/debug/with_view_transform_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright 2024 Democratized Data Foundation | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the file licenses/BSL.txt. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0, included in the file | ||
// licenses/APL.txt. | ||
|
||
package test_explain_debug | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/lens-vm/lens/host-go/config/model" | ||
testUtils "github.com/sourcenetwork/defradb/tests/integration" | ||
"github.com/sourcenetwork/defradb/tests/lenses" | ||
"github.com/sourcenetwork/immutable" | ||
) | ||
|
||
var transformViewPattern = dataMap{ | ||
"explain": dataMap{ | ||
"selectTopNode": dataMap{ | ||
"selectNode": dataMap{ | ||
"viewNode": dataMap{ | ||
"lensNode": dataMap{ | ||
"selectTopNode": dataMap{ | ||
"selectNode": dataMap{ | ||
"scanNode": dataMap{}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
func TestDebugExplainRequestWithViewWithTransform(t *testing.T) { | ||
test := testUtils.TestCase{ | ||
|
||
Description: "Explain (debug) request with view with transform", | ||
Actions: []any{ | ||
testUtils.SchemaUpdate{ | ||
Schema: ` | ||
type User { | ||
name: String | ||
} | ||
`, | ||
}, | ||
testUtils.CreateView{ | ||
Query: ` | ||
User { | ||
name | ||
} | ||
`, | ||
SDL: ` | ||
type UserView { | ||
fullName: String | ||
} | ||
`, | ||
Transform: immutable.Some(model.Lens{ | ||
Lenses: []model.LensModule{ | ||
{ | ||
Path: lenses.CopyModulePath, | ||
Arguments: map[string]any{ | ||
"src": "name", | ||
"dst": "fullName", | ||
}, | ||
}, | ||
}, | ||
}), | ||
}, | ||
testUtils.ExplainRequest{ | ||
Request: `query @explain(type: debug) { | ||
UserView { | ||
fullName | ||
} | ||
}`, | ||
ExpectedPatterns: []dataMap{transformViewPattern}, | ||
}, | ||
}, | ||
} | ||
|
||
testUtils.ExecuteTestCase(t, test) | ||
} |