Skip to content

Commit

Permalink
test(term): relax interval assertion in import test
Browse files Browse the repository at this point in the history
  • Loading branch information
ymgyt committed Aug 25, 2024
1 parent cc501c7 commit 822d6f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
17 changes: 9 additions & 8 deletions crates/synd_term/src/cli/command/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,17 @@ mod tests {
};

let base_feed: types::Feed = Faker.fake();
let interval = Duration::from_millis(10);
let interval = Duration::from_millis(100);
let mut prev = None;
let mut client = MockSubscribeFeed::new();

client.expect_subscribe_feed().returning(move |input| {
let now = Instant::now();
if let Some(prev) = prev {
assert!(
now.duration_since(prev) > interval,
// Dut to insability in the CI execution
// the interval assertion has been relaxed
now.duration_since(prev) >= (interval - Duration::from_millis(50)),
"the interval between requests is too short"
);
}
Expand Down Expand Up @@ -265,11 +267,10 @@ mod tests {
import.import().await.unwrap();

let buf = String::from_utf8_lossy(out.as_slice());
// insta::with_settings!({
// description => "import command output"
// }, {
// insta::assert_snapshot!("import_usecase",buf);
// });
println!("{buf}");
insta::with_settings!({
description => "import command output"
}, {
insta::assert_snapshot!("import_usecase",buf);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: crates/synd_term/src/cli/command/import.rs
description: import command output
expression: buf
---
OK MUST rust https://ok1.ymgyt.io/feed.xml
OK MUST rust https://ok1.ymgyt.io/feed.xml
ERROR https://err_unavailable.ymgyt.io/feed.xml server return 500 error
OK SHOULD rust https://ok2.ymgyt.io/feed.xml
OK SHOULD longcategory https://ok2.ymgyt.io/feed.xml
2/3 feeds successfully subscribed

This file was deleted.

0 comments on commit 822d6f4

Please sign in to comment.