graphql-engine/v3/crates/engine/tests/introspection.rs
Samir Talwar 5a0102b407 Avoid .unwrap in favor of anyhow for better error messages in tests. (#430)
I am struggling to diagnose some errors and `.unwrap` is not helping, as
it doesn't properly capture stack traces or anything else that might be
useful.

`anyhow` was built for this. Let's use it.

I had to convert `SessionError` to a real `Error`, which I don't think
is a bad thing.

V3_GIT_ORIGIN_REV_ID: 3b8a70bb87e12e7b9e39515cd5f769fbd2cbfb39
2024-04-02 17:06:56 +00:00

55 lines
1.8 KiB
Rust

#[allow(dead_code)]
mod common;
#[test]
fn test_introspect_command_with_preset_arguments() -> anyhow::Result<()> {
let common_metadata_path_string = "execute/common_metadata/custom_connector_schema.json";
let common_command_metadata_path_string = "execute/common_metadata/command_metadata.json";
common::test_introspection_expectation(
"execute/commands/functions/command_argument_presets/",
&[
common_metadata_path_string,
common_command_metadata_path_string,
],
)
}
#[test]
fn test_introspect_model_with_preset_arguments_select_many() -> anyhow::Result<()> {
let common_metadata_path_string = "execute/common_metadata/custom_connector_schema.json";
let common_command_metadata_path_string = "execute/common_metadata/command_metadata.json";
common::test_introspection_expectation(
"execute/commands/functions/model_argument_presets_select_many/",
&[
common_metadata_path_string,
common_command_metadata_path_string,
],
)
}
#[test]
fn test_introspect_model_with_preset_arguments_select_one() -> anyhow::Result<()> {
let common_metadata_path_string = "execute/common_metadata/custom_connector_schema.json";
let common_command_metadata_path_string = "execute/common_metadata/command_metadata.json";
common::test_introspection_expectation(
"execute/commands/functions/model_argument_presets_select_one/",
&[
common_metadata_path_string,
common_command_metadata_path_string,
],
)
}
#[test]
fn test_graphql_deprecated() -> anyhow::Result<()> {
let common_custom_connector_path_string =
"execute/common_metadata/custom_connector_schema.json";
common::test_introspection_expectation(
"execute/deprecated",
&[common_custom_connector_path_string],
)
}