MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / test_anonymous_view

Function test_anonymous_view

crates/core/src/sql/execute.rs:946–970  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

944
945 #[tokio::test]
946 async fn test_anonymous_view() -> anyhow::Result<()> {
947 let db = TestDB::in_memory()?;
948
949 let schema = [("a", AlgebraicType::U8), ("b", AlgebraicType::U8)];
950 let (_, table_id) = tests_utils::create_view_for_test(&db, "my_view", &schema, true)?;
951
952 with_auto_commit(&db, |tx| -> Result<_, DBError> {
953 tests_utils::insert_into_view(&db, tx, table_id, None, product![0u8, 1u8])?;
954 tests_utils::insert_into_view(&db, tx, table_id, None, product![0u8, 2u8])?;
955 Ok(())
956 })?;
957
958 let id = identity_from_u8(1);
959 let auth = AuthCtx::new(Identity::ZERO, id);
960
961 assert_query_results(
962 db.clone(),
963 "select b from my_view",
964 auth,
965 [product![1u8], product![2u8]],
966 )
967 .await;
968
969 Ok(())
970 }
971
972 #[tokio::test]
973 async fn test_view_join_table() -> anyhow::Result<()> {

Callers

nothing calls this directly

Calls 8

create_view_for_testFunction · 0.85
with_auto_commitFunction · 0.85
insert_into_viewFunction · 0.85
assert_query_resultsFunction · 0.85
identity_from_u8Function · 0.70
OkFunction · 0.50
newFunction · 0.50
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…