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

Function copy_to_csv_with_header

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

Source from the content-addressed store, hash-verified

109
110#[tokio::test]
111async fn copy_to_csv_with_header() {
112 let srv = TestServer::start().await;
113
114 seed_collection(&srv, "copy_to_csv_hdr").await;
115
116 let (_dir, out_path) = temp_output_path(".csv");
117 srv.exec(&format!(
118 "COPY copy_to_csv_hdr TO '{out_path}' WITH (FORMAT csv, HEADER true)"
119 ))
120 .await
121 .expect("COPY TO CSV with header");
122
123 let content = std::fs::read_to_string(&out_path).expect("read output file");
124 let lines: Vec<&str> = content.lines().collect();
125 // First line is the header.
126 assert!(!lines.is_empty(), "expected at least a header line");
127 // Should have header + 3 data rows.
128 assert_eq!(lines.len(), 4, "expected header + 3 rows");
129}
130
131// ── test 4: CSV without header ───────────────────────────────────────────────
132

Callers

nothing calls this directly

Calls 5

seed_collectionFunction · 0.85
temp_output_pathFunction · 0.85
collectMethod · 0.80
expectMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected