MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / test_debug_with_clause_issue

Function test_debug_with_clause_issue

graphlite/tests/match_with_tests.rs:1852–1918  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1850
1851#[test]
1852fn test_debug_with_clause_issue() {
1853 let fixture = TestFixture::empty().expect("Failed to create test fixture");
1854
1855 // Create test graph
1856 fixture
1857 .query(&format!(
1858 "CREATE SCHEMA IF NOT EXISTS /{}",
1859 fixture.schema_name()
1860 ))
1861 .unwrap();
1862 fixture
1863 .query(&format!(
1864 "CREATE GRAPH /{}/debug_with",
1865 fixture.schema_name()
1866 ))
1867 .unwrap();
1868 fixture
1869 .query(&format!(
1870 "SESSION SET GRAPH /{}/debug_with",
1871 fixture.schema_name()
1872 ))
1873 .unwrap();
1874
1875 // Insert a user
1876 fixture.assert_query_succeeds("INSERT (user1:User {id: 1, name: 'Alice', score: 100})");
1877
1878 // Test 1: Simple MATCH - verify node properties exist
1879 let result = fixture
1880 .query("MATCH (u:User) RETURN u.id as id, u.name as name, u.score as score")
1881 .unwrap();
1882 assert_eq!(
1883 result.rows[0].values.get("id").unwrap(),
1884 &Value::Number(1.0)
1885 );
1886 assert_eq!(
1887 result.rows[0].values.get("name").unwrap(),
1888 &Value::String("Alice".to_string())
1889 );
1890 assert_eq!(
1891 result.rows[0].values.get("score").unwrap(),
1892 &Value::Number(100.0)
1893 );
1894
1895 // Test 2: MATCH with WITH but no INSERT - does WITH preserve node properties?
1896 let result = fixture.query(
1897 "MATCH (u:User {name: 'Alice'})
1898 WITH u, u.name as user_name, u.score as user_score
1899 RETURN u.id as user_id, user_name, user_score",
1900 );
1901
1902 match result {
1903 Ok(query_result) => {
1904 if query_result.rows.is_empty() {
1905 // Let's try a simpler WITH clause
1906 let simple_result =
1907 fixture.query("MATCH (u:User {name: 'Alice'}) WITH u RETURN u.id as user_id");
1908 match simple_result {
1909 Ok(simple_query_result) => if simple_query_result.rows.is_empty() {},

Callers

nothing calls this directly

Calls 5

unwrapMethod · 0.80
queryMethod · 0.45
assert_query_succeedsMethod · 0.45
is_emptyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected