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

Function copy_autodetect_ndjson_extension

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

Source from the content-addressed store, hash-verified

114
115#[tokio::test]
116async fn copy_autodetect_ndjson_extension() {
117 let srv = TestServer::start().await;
118
119 srv.exec("CREATE COLLECTION copy_ext_test (id INT, name TEXT)")
120 .await
121 .expect("CREATE COLLECTION");
122
123 let ndjson = "{\"id\": 1, \"name\": \"alice\"}\n{\"id\": 2, \"name\": \"bob\"}\n";
124 let f = write_temp(ndjson, ".ndjson");
125 let path = f.path().to_string_lossy().to_string();
126 // Path ends in .ndjson — no WITH clause needed.
127 srv.exec(&format!("COPY copy_ext_test FROM '{path}'"))
128 .await
129 .expect("COPY with .ndjson extension");
130
131 assert_eq!(count_rows(&srv, "copy_ext_test").await, 2);
132}
133
134// ── test 5: explicit FORMAT csv with non-default delimiter ──────────────────
135

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