-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uncomment device detection toml test
- Loading branch information
Jake Champion
authored
Mar 6, 2024
1 parent
6a0bb0c
commit 8c7858a
Showing
1 changed file
with
58 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
// use crate::common::{Test, TestResult}; | ||
// use hyper::{body::to_bytes, StatusCode}; | ||
use crate::common::{Test, TestResult}; | ||
use hyper::{body::to_bytes, StatusCode}; | ||
|
||
// #[tokio::test(flavor = "multi_thread")] | ||
// async fn json_device_detection_lookup_works() -> TestResult { | ||
// const FASTLY_TOML: &str = r#" | ||
// name = "json-device-detection-lookup" | ||
// description = "json device detection lookup test" | ||
// authors = ["Test User <[email protected]>"] | ||
// language = "rust" | ||
// [local_server] | ||
// [local_server.device_detection] | ||
// file = "../test-fixtures/data/device-detection-mapping.json" | ||
// format = "json" | ||
// "#; | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn json_device_detection_lookup_works() -> TestResult { | ||
const FASTLY_TOML: &str = r#" | ||
name = "json-device-detection-lookup" | ||
description = "json device detection lookup test" | ||
authors = ["Test User <[email protected]>"] | ||
language = "rust" | ||
[local_server] | ||
[local_server.device_detection] | ||
file = "../test-fixtures/data/device-detection-mapping.json" | ||
format = "json" | ||
"#; | ||
|
||
// let resp = Test::using_fixture("device-detection-lookup.wasm") | ||
// .using_fastly_toml(FASTLY_TOML)? | ||
// .against_empty() | ||
// .await?; | ||
let resp = Test::using_fixture("device-detection-lookup.wasm") | ||
.using_fastly_toml(FASTLY_TOML)? | ||
.against_empty() | ||
.await?; | ||
|
||
// assert_eq!(resp.status(), StatusCode::OK); | ||
// assert!(to_bytes(resp.into_body()) | ||
// .await | ||
// .expect("can read body") | ||
// .to_vec() | ||
// .is_empty()); | ||
assert_eq!(resp.status(), StatusCode::OK); | ||
assert!(to_bytes(resp.into_body()) | ||
.await | ||
.expect("can read body") | ||
.to_vec() | ||
.is_empty()); | ||
|
||
// Ok(()) | ||
// } | ||
Ok(()) | ||
} | ||
|
||
// #[tokio::test(flavor = "multi_thread")] | ||
// async fn inline_toml_device_detection_lookup_works() -> TestResult { | ||
// const FASTLY_TOML: &str = r#" | ||
// name = "inline-toml-device-detection-lookup" | ||
// description = "inline toml device detection lookup test" | ||
// authors = ["Test User <[email protected]>"] | ||
// language = "rust" | ||
// [local_server] | ||
// [local_server.device_detection] | ||
// format = "inline-toml" | ||
// [local_server.device_detection.user_agents] | ||
// [local_server.device_detection.user_agents."Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0 [FBAN/FBIOS;FBAV/8.0.0.28.18;FBBV/1665515;FBDV/iPhone4,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/7.0.4;FBSS/2; FBCR/Telekom.de;FBID/phone;FBLC/de_DE;FBOP/5]"] | ||
// user_agent = {} | ||
// os = {} | ||
// device = {name = "iPhone", brand = "Apple", model = "iPhone4,1", hwtype = "Mobile Phone", is_ereader = false, is_gameconsole = false, is_mediaplayer = false, is_mobile = true, is_smarttv = false, is_tablet = false, is_tvplayer = false, is_desktop = false, is_touchscreen = true } | ||
// [local_server.device_detection.user_agents."ghosts-app/1.0.2.1 (ASUSTeK COMPUTER INC.; X550CC; Windows 8 (X86); en)"] | ||
// user_agent = {} | ||
// os = {} | ||
// device = {name = "Asus TeK", brand = "Asus", model = "TeK", is_desktop = false } | ||
// "#; | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn inline_toml_device_detection_lookup_works() -> TestResult { | ||
const FASTLY_TOML: &str = r#" | ||
name = "inline-toml-device-detection-lookup" | ||
description = "inline toml device detection lookup test" | ||
authors = ["Test User <[email protected]>"] | ||
language = "rust" | ||
[local_server] | ||
[local_server.device_detection] | ||
format = "inline-toml" | ||
[local_server.device_detection.user_agents] | ||
[local_server.device_detection.user_agents."Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20100101 Firefox/10.0 [FBAN/FBIOS;FBAV/8.0.0.28.18;FBBV/1665515;FBDV/iPhone4,1;FBMD/iPhone;FBSN/iPhone OS;FBSV/7.0.4;FBSS/2; FBCR/Telekom.de;FBID/phone;FBLC/de_DE;FBOP/5]"] | ||
user_agent = {} | ||
os = {} | ||
device = {name = "iPhone", brand = "Apple", model = "iPhone4,1", hwtype = "Mobile Phone", is_ereader = false, is_gameconsole = false, is_mediaplayer = false, is_mobile = true, is_smarttv = false, is_tablet = false, is_tvplayer = false, is_desktop = false, is_touchscreen = true } | ||
[local_server.device_detection.user_agents."ghosts-app/1.0.2.1 (ASUSTeK COMPUTER INC.; X550CC; Windows 8 (X86); en)"] | ||
user_agent = {} | ||
os = {} | ||
device = {name = "Asus TeK", brand = "Asus", model = "TeK", is_desktop = false } | ||
"#; | ||
|
||
// let resp = Test::using_fixture("device-detection-lookup.wasm") | ||
// .using_fastly_toml(FASTLY_TOML)? | ||
// .against_empty() | ||
// .await?; | ||
let resp = Test::using_fixture("device-detection-lookup.wasm") | ||
.using_fastly_toml(FASTLY_TOML)? | ||
.against_empty() | ||
.await?; | ||
|
||
// assert_eq!(resp.status(), StatusCode::OK); | ||
// assert!(to_bytes(resp.into_body()) | ||
// .await | ||
// .expect("can read body") | ||
// .to_vec() | ||
// .is_empty()); | ||
assert_eq!(resp.status(), StatusCode::OK); | ||
assert!(to_bytes(resp.into_body()) | ||
.await | ||
.expect("can read body") | ||
.to_vec() | ||
.is_empty()); | ||
|
||
// Ok(()) | ||
// } | ||
Ok(()) | ||
} |