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

Function copy_ndjson_roundtrip

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

Source from the content-addressed store, hash-verified

40
41#[tokio::test]
42async fn copy_ndjson_roundtrip() {
43 let srv = TestServer::start().await;
44
45 srv.exec("CREATE COLLECTION copy_ndjson_test (id INT, name TEXT, score FLOAT)")
46 .await
47 .expect("CREATE COLLECTION");
48
49 let ndjson = r#"{"id": 1, "name": "alice", "score": 9.5}
50{"id": 2, "name": "bob", "score": 8.1}
51{"id": 3, "name": "carol", "score": 7.7}
52{"id": 4, "name": "dave", "score": 6.2}
53{"id": 5, "name": "eve", "score": 5.0}
54"#;
55 let f = write_temp(ndjson, ".ndjson");
56 let path = f.path().to_string_lossy().to_string();
57
58 srv.exec(&format!("COPY copy_ndjson_test FROM '{path}'"))
59 .await
60 .expect("COPY NDJSON");
61
62 assert_eq!(count_rows(&srv, "copy_ndjson_test").await, 5);
63}
64
65// ── test 2: JSON array import ────────────────────────────────────────────────
66

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