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

Function copy_csv_with_header

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

Source from the content-addressed store, hash-verified

93
94#[tokio::test]
95async fn copy_csv_with_header() {
96 let srv = TestServer::start().await;
97
98 srv.exec("CREATE COLLECTION copy_csv_test (id INT, name TEXT, score FLOAT)")
99 .await
100 .expect("CREATE COLLECTION");
101
102 let csv = "id,name,score\n1,alice,9.5\n2,bob,8.1\n3,carol,7.7\n4,dave,6.2\n5,eve,5.0\n";
103 let f = write_temp(csv, ".csv");
104 let path = f.path().to_string_lossy().to_string();
105
106 srv.exec(&format!("COPY copy_csv_test FROM '{path}'"))
107 .await
108 .expect("COPY CSV");
109
110 assert_eq!(count_rows(&srv, "copy_csv_test").await, 5);
111}
112
113// ── test 4: auto-detect extension ────────────────────────────────────────────
114

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