🔥 remove: redundant forge-web-app tests
Browse files at this commitd0fe114d07f8d05988fe6b659e213ae3ee7b8b20Parent: 458e2198 changed files +0 -185
- crates/forge-web-app/src/ci/live.rs +0 -10
- crates/forge-web-app/src/ci/metrics_chart.rs +0 -11
- crates/forge-web-app/src/mail/templates.rs +0 -16
- crates/forge-web-app/src/notify.rs +0 -11
- crates/forge-web-app/src/views/heatmap.rs +0 -30
- crates/forge-web-app/src/views/mod.rs +0 -65
- crates/forge-web-app/src/views/repo_list.rs +0 -28
- crates/forge-web-app/src/views/timeline.rs +0 -14
crates/forge-web-app/src/ci/live.rsmodified+0 -10
| @@ -199,16 +199,6 @@ mod tests { | ||
| 199 | 199 | assert!(!run.has_changed().expect("open")); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - #[test] | |
| 203 | - fn a_bump_drops_the_entry_once_its_last_receiver_is_gone() { | |
| 204 | - let live = CiLive::default(); | |
| 205 | - let rx = live.subscribe_job("job-1"); | |
| 206 | - assert_eq!(live.jobs.counters().len(), 1); | |
| 207 | - drop(rx); | |
| 208 | - live.bump_job("job-1"); | |
| 209 | - assert!(live.jobs.counters().is_empty()); | |
| 210 | - } | |
| 211 | - | |
| 212 | 202 | #[tokio::test] |
| 213 | 203 | async fn a_runner_wakes_the_pages_only_when_its_online_state_changes() { |
| 214 | 204 | let live = CiLive::default(); |
crates/forge-web-app/src/ci/metrics_chart.rsmodified+0 -11
| @@ -251,15 +251,4 @@ mod tests { | ||
| 251 | 251 | assert_eq!(d.matches('M').count(), 2, "{d}"); |
| 252 | 252 | assert_eq!(d.matches('L').count(), 0, "{d}"); |
| 253 | 253 | } |
| 254 | - | |
| 255 | - #[test] | |
| 256 | - fn nice_max_rounds_up_to_one_two_two_and_a_half_or_five() { | |
| 257 | - assert_eq!(nice_max(0), 1); | |
| 258 | - assert_eq!(nice_max(10), 10); | |
| 259 | - assert_eq!(nice_max(11), 20); | |
| 260 | - assert_eq!(nice_max(1500), 2000); | |
| 261 | - assert_eq!(nice_max(2400), 2500); | |
| 262 | - assert_eq!(nice_max(3_145_728), 5_000_000); | |
| 263 | - assert_eq!(nice_max(15_000_000_000_000_000_000), u64::MAX); | |
| 264 | - } | |
| 265 | 254 | } |
crates/forge-web-app/src/mail/templates.rsmodified+0 -16
| @@ -215,12 +215,6 @@ mod tests { | ||
| 215 | 215 | assert!(!body.contains(&"x".repeat(COMMENT_LIMIT + 1))); |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - #[test] | |
| 219 | - fn short_comments_are_kept_whole() { | |
| 220 | - assert_eq!(truncate("héllo", 10), "héllo"); | |
| 221 | - assert_eq!(truncate("héllo", 2), "hé…"); | |
| 222 | - } | |
| 223 | - | |
| 224 | 218 | #[test] |
| 225 | 219 | fn body_has_the_actor_line_comment_url_and_footer_in_order() { |
| 226 | 220 | let (_, body) = notification(Lang::En, &sample(Some("Looks good"), "T")); |
| @@ -236,16 +230,6 @@ mod tests { | ||
| 236 | 230 | ); |
| 237 | 231 | } |
| 238 | 232 | |
| 239 | - #[test] | |
| 240 | - fn turkish_mail_uses_the_turkish_phrases() { | |
| 241 | - let (_, body) = notification(Lang::Tr, &sample(None, "T")); | |
| 242 | - assert!(body.starts_with("tahinli yorum yaptı."), "{body}"); | |
| 243 | - assert!( | |
| 244 | - body.contains("Bu e-postayı şu nedenle alıyorsunuz:"), | |
| 245 | - "{body}" | |
| 246 | - ); | |
| 247 | - } | |
| 248 | - | |
| 249 | 233 | #[test] |
| 250 | 234 | fn a_system_change_reads_as_someone() { |
| 251 | 235 | let mut ctx = sample(None, "T"); |
crates/forge-web-app/src/notify.rsmodified+0 -11
| @@ -1045,15 +1045,4 @@ mod tests { | ||
| 1045 | 1045 | .await; |
| 1046 | 1046 | assert!(mail_to(&fx, "bob@test.example").await.is_empty()); |
| 1047 | 1047 | } |
| 1048 | - | |
| 1049 | - #[test] | |
| 1050 | - fn host_of_drops_scheme_port_and_path() { | |
| 1051 | - assert_eq!( | |
| 1052 | - host_of("https://forge.example.com:8443/"), | |
| 1053 | - "forge.example.com" | |
| 1054 | - ); | |
| 1055 | - assert_eq!(host_of("http://127.0.0.1:7660"), "127.0.0.1"); | |
| 1056 | - assert_eq!(host_of("forge.test/x"), "forge.test"); | |
| 1057 | - assert_eq!(host_of("https:///"), "localhost"); | |
| 1058 | - } | |
| 1059 | 1048 | } |
crates/forge-web-app/src/views/heatmap.rsmodified+0 -30
| @@ -482,16 +482,6 @@ mod tests { | ||
| 482 | 482 | pairs.iter().map(|(d, n)| ((*d).to_owned(), *n)).collect() |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - fn day(cal: &Calendar, date: (i64, i64, i64)) -> Day { | |
| 486 | - cal.weeks | |
| 487 | - .iter() | |
| 488 | - .flatten() | |
| 489 | - .flatten() | |
| 490 | - .find(|d| d.date == date) | |
| 491 | - .copied() | |
| 492 | - .expect("day is in the window") | |
| 493 | - } | |
| 494 | - | |
| 495 | 485 | #[test] |
| 496 | 486 | fn empty_input_gives_an_empty_calendar() { |
| 497 | 487 | let cal = build(&[], TODAY); |
| @@ -560,18 +550,6 @@ mod tests { | ||
| 560 | 550 | assert_eq!(cal.total, 36); |
| 561 | 551 | } |
| 562 | 552 | |
| 563 | - #[test] | |
| 564 | - fn levels_follow_the_fixed_buckets() { | |
| 565 | - assert_eq!( | |
| 566 | - [0, 1, 3, 4, 7, 8, 12, 13, 500].map(level), | |
| 567 | - [0, 1, 1, 2, 2, 3, 3, 4, 4] | |
| 568 | - ); | |
| 569 | - let cal = build(&counts(&[("2026-10-16", 8), ("2026-10-15", 1)]), TODAY); | |
| 570 | - assert_eq!(day(&cal, TODAY).level, 3); | |
| 571 | - assert_eq!(day(&cal, (2026, 10, 15)).level, 1); | |
| 572 | - assert_eq!(day(&cal, (2026, 10, 14)).level, 0); | |
| 573 | - } | |
| 574 | - | |
| 575 | 553 | #[test] |
| 576 | 554 | fn window_is_53_monday_first_weeks_ending_this_week() { |
| 577 | 555 | let cal = build(&[], TODAY); |
| @@ -610,14 +588,6 @@ mod tests { | ||
| 610 | 588 | assert_eq!(cal.total, 1); |
| 611 | 589 | } |
| 612 | 590 | |
| 613 | - #[test] | |
| 614 | - fn month_labels_start_at_the_first_column_holding_the_first() { | |
| 615 | - let cal = build(&[], TODAY); | |
| 616 | - assert_eq!(cal.months[0], (2, 11)); | |
| 617 | - assert!(cal.months.contains(&(50, 10))); | |
| 618 | - assert_eq!(cal.months.len(), 12); | |
| 619 | - } | |
| 620 | - | |
| 621 | 591 | #[test] |
| 622 | 592 | fn leap_day_is_a_real_date() { |
| 623 | 593 | let cal = build( |
crates/forge-web-app/src/views/mod.rsmodified+0 -65
| @@ -1591,12 +1591,6 @@ pub fn ssh_clone_url(config: &Config, owner: &str, name: &str) -> String { | ||
| 1591 | 1591 | mod tests { |
| 1592 | 1592 | use super::*; |
| 1593 | 1593 | |
| 1594 | - #[test] | |
| 1595 | - fn enc_keeps_slashes_and_escapes_the_rest() { | |
| 1596 | - assert_eq!(enc("feature/x y#1"), "feature/x%20y%231"); | |
| 1597 | - assert_eq!(enc("a~b.c_d-e"), "a~b.c_d-e"); | |
| 1598 | - } | |
| 1599 | - | |
| 1600 | 1594 | #[test] |
| 1601 | 1595 | fn live_strip_is_one_pill_for_one_run_and_a_summary_for_more() { |
| 1602 | 1596 | let run = |state, number| ActorRun { |
| @@ -1706,63 +1700,4 @@ mod tests { | ||
| 1706 | 1700 | assert_eq!(origin_of("https://user:pw@files.test"), None); |
| 1707 | 1701 | assert_eq!(csp_for(None), CSP); |
| 1708 | 1702 | } |
| 1709 | - | |
| 1710 | - #[test] | |
| 1711 | - fn iso_time_matches_known_instants() { | |
| 1712 | - assert_eq!(iso_time(0), "1970-01-01T00:00:00Z"); | |
| 1713 | - assert_eq!(iso_time(1_700_000_000), "2023-11-14T22:13:20Z"); | |
| 1714 | - assert_eq!(iso_time(951_782_400), "2000-02-29T00:00:00Z"); | |
| 1715 | - } | |
| 1716 | - | |
| 1717 | - #[test] | |
| 1718 | - fn relative_time_picks_the_unit() { | |
| 1719 | - assert_eq!(relative_time(Lang::En, 100, 110), "just now"); | |
| 1720 | - assert_eq!(relative_time(Lang::En, 0, 120), "2 minutes ago"); | |
| 1721 | - assert_eq!(relative_time(Lang::En, 0, 3_600), "1 hour ago"); | |
| 1722 | - assert_eq!(relative_time(Lang::En, 0, 2 * 86_400), "2 days ago"); | |
| 1723 | - assert_eq!(relative_time(Lang::En, 0, 10), "just now"); | |
| 1724 | - assert_eq!(relative_time(Lang::En, 0, 30 * 86_400), "1 month ago"); | |
| 1725 | - assert_eq!(relative_time(Lang::En, 0, 365 * 86_400), "1 year ago"); | |
| 1726 | - assert_eq!(relative_time(Lang::En, 0, 2 * 365 * 86_400), "2 years ago"); | |
| 1727 | - assert_eq!(relative_time(Lang::Tr, 100, 110), "az önce"); | |
| 1728 | - assert_eq!(relative_time(Lang::Tr, 0, 60), "1 dakika önce"); | |
| 1729 | - assert_eq!(relative_time(Lang::Tr, 0, 5 * 60), "5 dakika önce"); | |
| 1730 | - assert_eq!(relative_time(Lang::Tr, 0, 3 * 3_600), "3 saat önce"); | |
| 1731 | - assert_eq!(relative_time(Lang::Tr, 0, 3 * 86_400), "3 gün önce"); | |
| 1732 | - assert_eq!(relative_time(Lang::Tr, 0, 2 * 2_592_000), "2 ay önce"); | |
| 1733 | - assert_eq!(relative_time(Lang::Tr, 0, 365 * 86_400), "1 yıl önce"); | |
| 1734 | - assert_eq!( | |
| 1735 | - rel_words(Lang::En), | |
| 1736 | - "just now|{n} minute ago|{n} minutes ago|{n} hour ago|{n} hours ago|{n} day ago|\ | |
| 1737 | - {n} days ago|{n} month ago|{n} months ago|{n} year ago|{n} years ago|\ | |
| 1738 | - in {n} minute|in {n} minutes|in {n} hour|in {n} hours|in {n} day|in {n} days|\ | |
| 1739 | - in {n} month|in {n} months|in {n} year|in {n} years" | |
| 1740 | - ); | |
| 1741 | - assert_eq!(rel_words(Lang::Tr).split('|').nth(4), Some("{n} saat önce")); | |
| 1742 | - } | |
| 1743 | - | |
| 1744 | - #[test] | |
| 1745 | - fn short_oid_and_sizes() { | |
| 1746 | - assert_eq!(short_oid("0123456789abcdef"), "0123456"); | |
| 1747 | - assert_eq!(human_size(Lang::En, 12), "12 bytes"); | |
| 1748 | - assert_eq!(human_size(Lang::En, 2048), "2.0 KiB"); | |
| 1749 | - assert_eq!(human_size(Lang::En, 1_572_864), "1.5 MiB"); | |
| 1750 | - assert_eq!(human_size(Lang::Tr, 512), "512 bayt"); | |
| 1751 | - assert_eq!(human_size(Lang::Tr, 2048), "2,0 KiB"); | |
| 1752 | - assert_eq!(human_size(Lang::Tr, 1_572_864), "1,5 MiB"); | |
| 1753 | - } | |
| 1754 | - | |
| 1755 | - #[test] | |
| 1756 | - fn ghost_and_visibility_labels_follow_the_language() { | |
| 1757 | - assert_eq!(i18n::deleted_user(Lang::En), "Deleted user"); | |
| 1758 | - assert_eq!(i18n::deleted_user(Lang::Tr), "Silinmiş kullanıcı"); | |
| 1759 | - assert_eq!( | |
| 1760 | - i18n::visibility_label(Lang::Tr, forge_core::Visibility::Public), | |
| 1761 | - "Herkese açık" | |
| 1762 | - ); | |
| 1763 | - assert_eq!( | |
| 1764 | - i18n::visibility_label(Lang::En, forge_core::Visibility::Private), | |
| 1765 | - "Private" | |
| 1766 | - ); | |
| 1767 | - } | |
| 1768 | 1703 | } |
crates/forge-web-app/src/views/repo_list.rsmodified+0 -28
| @@ -190,31 +190,3 @@ pub fn pager_links( | ||
| 190 | 190 | let next = (page < pages).then(|| href(page + 1)); |
| 191 | 191 | (links, prev, next) |
| 192 | 192 | } |
| 193 | - | |
| 194 | -#[cfg(test)] | |
| 195 | -mod tests { | |
| 196 | - use super::page_numbers; | |
| 197 | - | |
| 198 | - fn shown(page: u64, pages: u64) -> String { | |
| 199 | - page_numbers(page, pages) | |
| 200 | - .into_iter() | |
| 201 | - .map(|n| n.map_or("...".to_owned(), |n| n.to_string())) | |
| 202 | - .collect::<Vec<_>>() | |
| 203 | - .join(" ") | |
| 204 | - } | |
| 205 | - | |
| 206 | - #[test] | |
| 207 | - fn pages_are_compact_with_gaps() { | |
| 208 | - assert_eq!(shown(1, 1), "1"); | |
| 209 | - assert_eq!(shown(1, 3), "1 2 3"); | |
| 210 | - assert_eq!(shown(1, 7), "1 2 3 4 5 6 7"); | |
| 211 | - assert_eq!(shown(5, 12), "1 ... 4 5 6 ... 12"); | |
| 212 | - assert_eq!(shown(1, 12), "1 2 3 4 5 ... 12"); | |
| 213 | - assert_eq!(shown(12, 12), "1 ... 8 9 10 11 12"); | |
| 214 | - assert_eq!(shown(4, 12), "1 2 3 4 5 ... 12"); | |
| 215 | - assert_eq!(shown(9, 12), "1 ... 8 9 10 11 12"); | |
| 216 | - for page in 1..=54 { | |
| 217 | - assert_eq!(page_numbers(page, 54).len(), 7, "page {page}"); | |
| 218 | - } | |
| 219 | - } | |
| 220 | -} |
crates/forge-web-app/src/views/timeline.rsmodified+0 -14
| @@ -84,17 +84,3 @@ pub async fn history_strip( | ||
| 84 | 84 | } |
| 85 | 85 | }) |
| 86 | 86 | } |
| 87 | - | |
| 88 | -#[cfg(test)] | |
| 89 | -mod tests { | |
| 90 | - use super::*; | |
| 91 | - | |
| 92 | - #[test] | |
| 93 | - fn bar_heights_are_log_scaled_with_a_floor() { | |
| 94 | - assert_eq!(bar_percent(0, 0), MIN_BAR_PERCENT); | |
| 95 | - assert_eq!(bar_percent(0, 1000), MIN_BAR_PERCENT); | |
| 96 | - assert_eq!(bar_percent(1000, 1000), 100); | |
| 97 | - assert_eq!(bar_percent(31, 999), 50); | |
| 98 | - assert!(bar_percent(10, 1000) > bar_percent(2, 1000)); | |
| 99 | - } | |
| 100 | -} |