Skip to content

Commit 3b0347d

Browse files
committed
change csv test to pass on mssql
1 parent ea07818 commit 3b0347d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

tests/index.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,12 @@ async fn test_csv_upload() -> actix_web::Result<()> {
119119
.insert_header(("content-type", "multipart/form-data; boundary=1234567890"))
120120
.set_payload(
121121
"--1234567890\r\n\
122-
Content-Disposition: form-data; name=\"prices_file\"; filename=\"prices.csv\"\r\n\
122+
Content-Disposition: form-data; name=\"people_file\"; filename=\"people.csv\"\r\n\
123123
Content-Type: text/csv\r\n\
124124
\r\n\
125-
price,quantity\r\n\
126-
1,5\r\n\
127-
2.5,4\r\n\
125+
name,age\r\n\
126+
Ophir,29\r\n\
127+
Max,99\r\n\
128128
--1234567890--\r\n",
129129
)
130130
.to_srv_request();
@@ -134,8 +134,8 @@ async fn test_csv_upload() -> actix_web::Result<()> {
134134
let body = test::read_body(resp).await;
135135
let body_str = String::from_utf8(body.to_vec()).unwrap();
136136
assert!(
137-
body_str.contains("total: 15"),
138-
"{body_str}\nexpected to contain: total: 15"
137+
body_str.contains("Ophir is 29 years old"),
138+
"{body_str}\nexpected to contain: Ophir is 29 years old"
139139
);
140140
Ok(())
141141
}

tests/upload_csv_test.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
create table bill(quantity text, price text);
2-
copy bill(quantity, price) from 'prices_file' with (format csv, header true);
1+
create table people(name text, age text);
2+
copy people(name, age) from 'people_file' with (format csv, header true);
33
select 'text' as component,
4-
'total: ' || sum(cast(quantity as float) * cast(price as float)) as contents
5-
from bill;
4+
name || ' is ' || age || ' years old. ' as contents
5+
from people;

0 commit comments

Comments
 (0)