add integration test
- Cargo.lock +60 -0
- Cargo.toml +1 -0
- tests/lib.rs +27 -0
Cargo.lock
CHANGED
|
@@ -665,8 +665,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
|
665
665
|
checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90"
|
|
666
666
|
dependencies = [
|
|
667
667
|
"futures-core",
|
|
668
|
+
"futures-io",
|
|
668
669
|
"futures-macro",
|
|
669
670
|
"futures-task",
|
|
671
|
+
"memchr",
|
|
670
672
|
"pin-project-lite 0.2.9",
|
|
671
673
|
"pin-utils",
|
|
672
674
|
"slab",
|
|
@@ -888,6 +890,22 @@ version = "2.5.0"
|
|
|
888
890
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
889
891
|
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
|
|
890
892
|
|
|
893
|
+
[[package]]
|
|
894
|
+
name = "mime"
|
|
895
|
+
version = "0.3.16"
|
|
896
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
897
|
+
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
|
898
|
+
|
|
899
|
+
[[package]]
|
|
900
|
+
name = "mime_guess"
|
|
901
|
+
version = "2.0.4"
|
|
902
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
903
|
+
checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
|
|
904
|
+
dependencies = [
|
|
905
|
+
"mime",
|
|
906
|
+
"unicase",
|
|
907
|
+
]
|
|
908
|
+
|
|
891
909
|
[[package]]
|
|
892
910
|
name = "num-integer"
|
|
893
911
|
version = "0.1.45"
|
|
@@ -1380,6 +1398,26 @@ version = "2.4.1"
|
|
|
1380
1398
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1381
1399
|
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
|
|
1382
1400
|
|
|
1401
|
+
[[package]]
|
|
1402
|
+
name = "surf"
|
|
1403
|
+
version = "2.3.2"
|
|
1404
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1405
|
+
checksum = "718b1ae6b50351982dedff021db0def601677f2120938b070eadb10ba4038dd7"
|
|
1406
|
+
dependencies = [
|
|
1407
|
+
"async-std",
|
|
1408
|
+
"async-trait",
|
|
1409
|
+
"cfg-if 1.0.0",
|
|
1410
|
+
"futures-util",
|
|
1411
|
+
"getrandom 0.2.7",
|
|
1412
|
+
"http-client",
|
|
1413
|
+
"http-types",
|
|
1414
|
+
"log",
|
|
1415
|
+
"mime_guess",
|
|
1416
|
+
"pin-project-lite 0.2.9",
|
|
1417
|
+
"serde",
|
|
1418
|
+
"serde_json",
|
|
1419
|
+
]
|
|
1420
|
+
|
|
1383
1421
|
[[package]]
|
|
1384
1422
|
name = "sval"
|
|
1385
1423
|
version = "1.0.0-alpha.5"
|
|
@@ -1471,6 +1509,7 @@ dependencies = [
|
|
|
1471
1509
|
"pretty_assertions",
|
|
1472
1510
|
"tide",
|
|
1473
1511
|
"tide-jsx-impl",
|
|
1512
|
+
"tide-testing",
|
|
1474
1513
|
"trybuild",
|
|
1475
1514
|
]
|
|
1476
1515
|
|
|
@@ -1484,6 +1523,18 @@ dependencies = [
|
|
|
1484
1523
|
"syn",
|
|
1485
1524
|
]
|
|
1486
1525
|
|
|
1526
|
+
[[package]]
|
|
1527
|
+
name = "tide-testing"
|
|
1528
|
+
version = "0.1.3"
|
|
1529
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1530
|
+
checksum = "5a59ea33dec6d205e4173cf7825dcfc78600c1726d931132d99b38b932495111"
|
|
1531
|
+
dependencies = [
|
|
1532
|
+
"serde",
|
|
1533
|
+
"serde_json",
|
|
1534
|
+
"surf",
|
|
1535
|
+
"tide",
|
|
1536
|
+
]
|
|
1537
|
+
|
|
1487
1538
|
[[package]]
|
|
1488
1539
|
name = "time"
|
|
1489
1540
|
version = "0.1.44"
|
|
@@ -1578,6 +1629,15 @@ version = "1.15.0"
|
|
|
1578
1629
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1579
1630
|
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
|
|
1580
1631
|
|
|
1632
|
+
[[package]]
|
|
1633
|
+
name = "unicase"
|
|
1634
|
+
version = "2.6.0"
|
|
1635
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1636
|
+
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
|
|
1637
|
+
dependencies = [
|
|
1638
|
+
"version_check",
|
|
1639
|
+
]
|
|
1640
|
+
|
|
1581
1641
|
[[package]]
|
|
1582
1642
|
name = "unicode-bidi"
|
|
1583
1643
|
version = "0.3.8"
|
Cargo.toml
CHANGED
|
@@ -18,3 +18,4 @@ tide = "0.16.0"
|
|
|
18
18
|
pretty_assertions = "0.6"
|
|
19
19
|
async-std = { version = "1.9.0", features = ["attributes"] }
|
|
20
20
|
trybuild = "1.0"
|
|
21
|
+
tide-testing = "0.1.3"
|
tests/lib.rs
CHANGED
|
@@ -251,3 +251,30 @@ mod other {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
|
+
|
|
255
|
+
mod integration {
|
|
256
|
+
use crate::view;
|
|
257
|
+
use tide_testing::TideTestingExt;
|
|
258
|
+
|
|
259
|
+
#[async_std::test]
|
|
260
|
+
async fn test_server() -> tide::Result<()> {
|
|
261
|
+
let mut app = tide::new();
|
|
262
|
+
app.at("/").get(|_| async {
|
|
263
|
+
view! {
|
|
264
|
+
<div>
|
|
265
|
+
<p>{"Hello World"}</p>
|
|
266
|
+
</div>
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
assert_eq!(
|
|
271
|
+
app.get("/").recv_string().await?,
|
|
272
|
+
"<div><p>Hello World</p></div>"
|
|
273
|
+
);
|
|
274
|
+
assert_eq!(
|
|
275
|
+
app.post("/missing").await?.status(),
|
|
276
|
+
tide::http::StatusCode::NotFound
|
|
277
|
+
);
|
|
278
|
+
Ok(())
|
|
279
|
+
}
|
|
280
|
+
}
|