MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / copy_json_array_roundtrip

Function copy_json_array_roundtrip

nodedb/tests/sql_copy_from.rs:68–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66
67#[tokio::test]
68async fn copy_json_array_roundtrip() {
69 let srv = TestServer::start().await;
70
71 srv.exec("CREATE COLLECTION copy_json_arr_test (id INT, name TEXT, score FLOAT)")
72 .await
73 .expect("CREATE COLLECTION");
74
75 let json = r#"[
76 {"id": 1, "name": "alice", "score": 9.5},
77 {"id": 2, "name": "bob", "score": 8.1},
78 {"id": 3, "name": "carol", "score": 7.7},
79 {"id": 4, "name": "dave", "score": 6.2},
80 {"id": 5, "name": "eve", "score": 5.0}
81]"#;
82 let f = write_temp(json, ".json");
83 let path = f.path().to_string_lossy().to_string();
84
85 srv.exec(&format!("COPY copy_json_arr_test FROM '{path}'"))
86 .await
87 .expect("COPY JSON array");
88
89 assert_eq!(count_rows(&srv, "copy_json_arr_test").await, 5);
90}
91
92// ── test 3: CSV import with header row ──────────────────────────────────────
93

Callers

nothing calls this directly

Calls 5

write_tempFunction · 0.85
to_stringMethod · 0.80
expectMethod · 0.45
execMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected