🔥 remove: redundant forge-web and web-base tests
Browse files at this commit535a37ecddd837ec1e53c7bc4ea92b95805106ebParent: ff1c91322 changed files +0 -806
- crates/forge-web-base/src/i18n/admin.rs +0 -36
- crates/forge-web-base/src/i18n/audit_names.rs +0 -104
- crates/forge-web-base/src/i18n/browse.rs +0 -14
- crates/forge-web-base/src/i18n/code.rs +0 -22
- crates/forge-web-base/src/i18n/community.rs +0 -30
- crates/forge-web-base/src/i18n/integrations.rs +0 -28
- crates/forge-web-base/src/i18n/issues.rs +0 -33
- crates/forge-web-base/src/i18n/merge_queue.rs +0 -8
- crates/forge-web-base/src/i18n/misc.rs +0 -45
- crates/forge-web-base/src/i18n/mod.rs +0 -15
- crates/forge-web-base/src/i18n/needs.rs +0 -13
- crates/forge-web-base/src/i18n/orgs.rs +0 -55
- crates/forge-web-base/src/i18n/pulls.rs +0 -32
- crates/forge-web-base/src/i18n/pulls_review.rs +0 -15
- crates/forge-web-base/src/i18n/releases_ci.rs +0 -33
- crates/forge-web-base/src/i18n/repo_admin.rs +0 -22
- crates/forge-web-base/src/i18n/server_settings.rs +0 -26
- crates/forge-web-base/src/render/highlight.rs +0 -23
- crates/forge-web-base/src/theme.rs +0 -7
- crates/forge-web/src/page_route_tests/notifications.rs +0 -30
- crates/forge-web/src/page_route_tests/repo.rs +0 -119
- crates/forge-web/src/templates_route_tests.rs +0 -96
crates/forge-web-base/src/i18n/admin.rsmodified+0 -36
| @@ -245,39 +245,3 @@ pub fn no_user_named(lang: Lang, actor: &str) -> String { | ||
| 245 | 245 | Lang::Tr => format!("{actor} adında bir kullanıcı yok."), |
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | - | |
| 249 | -#[cfg(test)] | |
| 250 | -mod tests { | |
| 251 | - use super::*; | |
| 252 | - | |
| 253 | - #[test] | |
| 254 | - fn every_variant_has_text_in_both_languages() { | |
| 255 | - for key in ALL { | |
| 256 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English text"); | |
| 257 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish text"); | |
| 258 | - } | |
| 259 | - } | |
| 260 | - | |
| 261 | - #[test] | |
| 262 | - fn turkish_differs_from_english_for_translated_variants() { | |
| 263 | - let differing = ALL | |
| 264 | - .iter() | |
| 265 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 266 | - .count(); | |
| 267 | - assert!(differing >= 3, "only {differing} variants are translated"); | |
| 268 | - } | |
| 269 | - | |
| 270 | - #[test] | |
| 271 | - fn english_text_matches_the_original_phrases() { | |
| 272 | - assert_eq!(t(Lang::En, K::DeleteUser), "Delete user"); | |
| 273 | - assert!(t(Lang::En, K::ReplicationOff).starts_with("Replication is off.")); | |
| 274 | - assert_eq!( | |
| 275 | - type_to_confirm(Lang::En, "tahinli"), | |
| 276 | - "Type tahinli to confirm" | |
| 277 | - ); | |
| 278 | - assert_eq!( | |
| 279 | - running_line(Lang::En, RunKind::Backup), | |
| 280 | - "A backup run is in progress." | |
| 281 | - ); | |
| 282 | - } | |
| 283 | -} |
crates/forge-web-base/src/i18n/audit_names.rsmodified+0 -104
| @@ -351,107 +351,3 @@ pub fn detail_key_name(lang: Lang, key: &str) -> Option<&'static str> { | ||
| 351 | 351 | _ => None, |
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | - | |
| 355 | -#[cfg(test)] | |
| 356 | -mod tests { | |
| 357 | - use super::*; | |
| 358 | - | |
| 359 | - const ACTION_IDS: &[&str] = &[ | |
| 360 | - "login_success", | |
| 361 | - "login_failed", | |
| 362 | - "login_2fa_failed", | |
| 363 | - "logout", | |
| 364 | - "password_changed", | |
| 365 | - "email_changed", | |
| 366 | - "password_reset_by_admin", | |
| 367 | - "totp_enabled", | |
| 368 | - "totp_disabled", | |
| 369 | - "recovery_codes_regenerated", | |
| 370 | - "ssh_key_added", | |
| 371 | - "ssh_key_removed", | |
| 372 | - "gpg_key_added", | |
| 373 | - "gpg_key_deleted", | |
| 374 | - "token_created", | |
| 375 | - "token_revoked", | |
| 376 | - "session_revoked", | |
| 377 | - "user_created", | |
| 378 | - "username_changed", | |
| 379 | - "user_deleted", | |
| 380 | - "repo_created", | |
| 381 | - "repo_deleted", | |
| 382 | - "repo_renamed", | |
| 383 | - "repo_transferred", | |
| 384 | - "repo_transfer_initiated", | |
| 385 | - "repo_transfer_accepted", | |
| 386 | - "repo_transfer_declined", | |
| 387 | - "repo_transfer_cancelled", | |
| 388 | - "repo_visibility_changed", | |
| 389 | - "collaborator_added", | |
| 390 | - "collaborator_removed", | |
| 391 | - "collaborator_role_changed", | |
| 392 | - "branch_rule_created", | |
| 393 | - "branch_rule_updated", | |
| 394 | - "branch_rule_deleted", | |
| 395 | - "repo_archived", | |
| 396 | - "repo_unarchived", | |
| 397 | - "webhook_created", | |
| 398 | - "webhook_updated", | |
| 399 | - "webhook_deleted", | |
| 400 | - "mirror_created", | |
| 401 | - "mirror_updated", | |
| 402 | - "mirror_deleted", | |
| 403 | - "mirror_sync_failed", | |
| 404 | - "backup_started", | |
| 405 | - "fsck_started", | |
| 406 | - "replication_reconcile_started", | |
| 407 | - "ci_secret_set", | |
| 408 | - "ci_secret_deleted", | |
| 409 | - "ci_runner_registered", | |
| 410 | - "ci_runner_deleted", | |
| 411 | - "ci_runner_restart_requested", | |
| 412 | - "ci_runner_config_changed", | |
| 413 | - "ci_registration_token_created", | |
| 414 | - "ui_prefs_changed", | |
| 415 | - "mail_settings_updated", | |
| 416 | - "mail_test_queued", | |
| 417 | - "server_settings_updated", | |
| 418 | - "server_restarted", | |
| 419 | - "org_created", | |
| 420 | - "org_deleted", | |
| 421 | - "org_settings_updated", | |
| 422 | - "org_member_added", | |
| 423 | - "org_member_removed", | |
| 424 | - "org_member_role_changed", | |
| 425 | - "team_created", | |
| 426 | - "team_updated", | |
| 427 | - "team_deleted", | |
| 428 | - "team_member_added", | |
| 429 | - "team_member_removed", | |
| 430 | - "team_repo_added", | |
| 431 | - "team_repo_removed", | |
| 432 | - "password_reset_completed", | |
| 433 | - "email_verified", | |
| 434 | - "invite_sent", | |
| 435 | - "invite_accepted", | |
| 436 | - "user_suspended", | |
| 437 | - "user_unsuspended", | |
| 438 | - "admin_granted", | |
| 439 | - "admin_revoked", | |
| 440 | - "totp_disabled_by_admin", | |
| 441 | - "passkey_added", | |
| 442 | - "passkey_renamed", | |
| 443 | - "passkey_deleted", | |
| 444 | - "passkeys_removed_by_admin", | |
| 445 | - "passkey_login", | |
| 446 | - ]; | |
| 447 | - | |
| 448 | - #[test] | |
| 449 | - fn every_action_has_both_names() { | |
| 450 | - for id in ACTION_IDS { | |
| 451 | - assert!( | |
| 452 | - action_name(Lang::En, id).is_some() && action_name(Lang::Tr, id).is_some(), | |
| 453 | - "{id}" | |
| 454 | - ); | |
| 455 | - } | |
| 456 | - } | |
| 457 | -} |
crates/forge-web-base/src/i18n/browse.rsmodified+0 -14
| @@ -81,14 +81,6 @@ pub fn blame_limit(lang: Lang, limit: &str) -> String { | ||
| 81 | 81 | mod tests { |
| 82 | 82 | use super::*; |
| 83 | 83 | |
| 84 | - #[test] | |
| 85 | - fn every_key_has_text_in_both_languages() { | |
| 86 | - for key in ALL { | |
| 87 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English text"); | |
| 88 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish text"); | |
| 89 | - } | |
| 90 | - } | |
| 91 | - | |
| 92 | 84 | #[test] |
| 93 | 85 | fn no_em_dashes() { |
| 94 | 86 | for key in ALL { |
| @@ -100,10 +92,4 @@ mod tests { | ||
| 100 | 92 | } |
| 101 | 93 | } |
| 102 | 94 | } |
| 103 | - | |
| 104 | - #[test] | |
| 105 | - fn helpers_carry_their_arguments() { | |
| 106 | - assert_eq!(ahead_behind(Lang::En, 3, 1), "3 ahead, 1 behind"); | |
| 107 | - assert!(blame_limit(Lang::En, "1 MiB").contains("1 MiB")); | |
| 108 | - } | |
| 109 | 95 | } |
crates/forge-web-base/src/i18n/code.rsmodified+0 -22
| @@ -247,25 +247,3 @@ pub fn mirror_sync_failed(lang: Lang) -> (&'static str, &'static str) { | ||
| 247 | 247 | Lang::Tr => ("son eşitleme ", " başarısız oldu"), |
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | - | |
| 251 | -#[cfg(test)] | |
| 252 | -mod tests { | |
| 253 | - use super::*; | |
| 254 | - | |
| 255 | - #[test] | |
| 256 | - fn every_key_has_text_in_both_languages() { | |
| 257 | - for key in ALL { | |
| 258 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English text"); | |
| 259 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish text"); | |
| 260 | - } | |
| 261 | - } | |
| 262 | - | |
| 263 | - #[test] | |
| 264 | - fn turkish_differs_from_english_for_several_keys() { | |
| 265 | - let differing = ALL | |
| 266 | - .iter() | |
| 267 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 268 | - .count(); | |
| 269 | - assert!(differing >= 3, "only {differing} keys differ"); | |
| 270 | - } | |
| 271 | -} |
crates/forge-web-base/src/i18n/community.rsmodified+0 -30
| @@ -29,33 +29,3 @@ pub fn comment_login_lead(lang: Lang) -> &'static str { | ||
| 29 | 29 | Lang::Tr => "Yorum yapmak için ", |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | - | |
| 33 | -#[cfg(test)] | |
| 34 | -mod tests { | |
| 35 | - use super::*; | |
| 36 | - | |
| 37 | - #[test] | |
| 38 | - fn every_key_has_both_languages() { | |
| 39 | - for key in ALL { | |
| 40 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 41 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 42 | - } | |
| 43 | - } | |
| 44 | - | |
| 45 | - #[test] | |
| 46 | - fn turkish_differs_from_english() { | |
| 47 | - let differing = ALL | |
| 48 | - .iter() | |
| 49 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 50 | - .count(); | |
| 51 | - assert!(differing >= 3, "only {differing} keys differ"); | |
| 52 | - } | |
| 53 | - | |
| 54 | - #[test] | |
| 55 | - fn counts_and_sentences_follow_the_language() { | |
| 56 | - assert_eq!(comments_count(Lang::En, 1), "1 comment"); | |
| 57 | - assert_eq!(comments_count(Lang::En, 3), "3 comments"); | |
| 58 | - assert_eq!(comments_count(Lang::Tr, 3), "3 yorum"); | |
| 59 | - assert_eq!(crate::i18n::page_label(Lang::Tr, 2), "Sayfa 2"); | |
| 60 | - } | |
| 61 | -} |
crates/forge-web-base/src/i18n/integrations.rsmodified+0 -28
| @@ -137,31 +137,3 @@ pub fn every_minutes(lang: Lang, minutes: u32) -> String { | ||
| 137 | 137 | Lang::Tr => format!("{minutes} dakikada bir"), |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | - | |
| 141 | -#[cfg(test)] | |
| 142 | -mod tests { | |
| 143 | - use super::*; | |
| 144 | - | |
| 145 | - #[test] | |
| 146 | - fn every_key_has_an_english_and_a_turkish_phrase() { | |
| 147 | - for key in ALL { | |
| 148 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 149 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 150 | - } | |
| 151 | - } | |
| 152 | - | |
| 153 | - #[test] | |
| 154 | - fn turkish_differs_from_english_for_some_keys() { | |
| 155 | - let differing = ALL | |
| 156 | - .iter() | |
| 157 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 158 | - .count(); | |
| 159 | - assert!(differing >= 3, "only {differing} keys differ"); | |
| 160 | - } | |
| 161 | - | |
| 162 | - #[test] | |
| 163 | - fn helpers_keep_english_wording() { | |
| 164 | - assert_eq!(every_hours(Lang::En, 8), "every 8 h"); | |
| 165 | - assert_eq!(every_minutes(Lang::En, 90), "every 90 min"); | |
| 166 | - } | |
| 167 | -} |
crates/forge-web-base/src/i18n/issues.rsmodified+0 -33
| @@ -493,36 +493,3 @@ pub fn commit_event_sides( | ||
| 493 | 493 | (Lang::Tr, _) => (verb.to_owned(), String::new()), |
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | - | |
| 497 | -#[cfg(test)] | |
| 498 | -mod tests { | |
| 499 | - use super::{ALL, Lang, commit_event_sides, t}; | |
| 500 | - | |
| 501 | - #[test] | |
| 502 | - fn every_key_has_both_languages() { | |
| 503 | - let mut differing = 0; | |
| 504 | - for key in ALL { | |
| 505 | - let en = t(Lang::En, *key); | |
| 506 | - let tr = t(Lang::Tr, *key); | |
| 507 | - assert!(!en.is_empty(), "{key:?} has no English text"); | |
| 508 | - assert!(!tr.is_empty(), "{key:?} has no Turkish text"); | |
| 509 | - if en != tr { | |
| 510 | - differing += 1; | |
| 511 | - } | |
| 512 | - } | |
| 513 | - assert!(differing >= 3, "only {differing} keys differ from English"); | |
| 514 | - } | |
| 515 | - | |
| 516 | - #[test] | |
| 517 | - fn english_commit_sides_are_unchanged() { | |
| 518 | - let (before, after) = commit_event_sides(Lang::En, "closed", "closed this", "", true); | |
| 519 | - assert_eq!((before.as_str(), after.as_str()), ("closed this in", "")); | |
| 520 | - let (before, after) = commit_event_sides(Lang::En, "merged", "merged commit", "main", true); | |
| 521 | - assert_eq!( | |
| 522 | - (before.as_str(), after.as_str()), | |
| 523 | - ("merged commit", "into main") | |
| 524 | - ); | |
| 525 | - let (before, after) = commit_event_sides(Lang::En, "merged", "merged commit", "", false); | |
| 526 | - assert_eq!((before.as_str(), after.as_str()), ("merged commit", "")); | |
| 527 | - } | |
| 528 | -} |
crates/forge-web-base/src/i18n/merge_queue.rsmodified+0 -8
| @@ -47,14 +47,6 @@ pub fn position_text(lang: Lang, position: usize) -> String { | ||
| 47 | 47 | mod tests { |
| 48 | 48 | use super::*; |
| 49 | 49 | |
| 50 | - #[test] | |
| 51 | - fn every_key_has_english_and_turkish() { | |
| 52 | - for key in ALL { | |
| 53 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 54 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 55 | - } | |
| 56 | - } | |
| 57 | - | |
| 58 | 50 | #[test] |
| 59 | 51 | fn position_line_counts_from_the_head() { |
| 60 | 52 | assert_eq!(position_text(Lang::En, 2), "Position 2 in the merge queue"); |
crates/forge-web-base/src/i18n/misc.rsmodified+0 -45
| @@ -328,48 +328,3 @@ fn capitalize(text: &str) -> String { | ||
| 328 | 328 | None => String::new(), |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | - | |
| 332 | -#[cfg(test)] | |
| 333 | -mod tests { | |
| 334 | - use super::*; | |
| 335 | - | |
| 336 | - #[test] | |
| 337 | - fn every_variant_has_both_languages() { | |
| 338 | - for key in ALL { | |
| 339 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 340 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 341 | - } | |
| 342 | - } | |
| 343 | - | |
| 344 | - #[test] | |
| 345 | - fn turkish_differs_from_english_for_translated_phrases() { | |
| 346 | - let differing = ALL | |
| 347 | - .iter() | |
| 348 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 349 | - .count(); | |
| 350 | - assert!(differing >= 3, "only {differing} phrases are translated"); | |
| 351 | - assert_eq!(t(Lang::Tr, K::Appearance), "Görünüm"); | |
| 352 | - } | |
| 353 | - | |
| 354 | - #[test] | |
| 355 | - fn activity_lines_keep_the_english_wording() { | |
| 356 | - assert_eq!( | |
| 357 | - activity_line(Lang::En, K::VerbOpened, Some("tahinli")), | |
| 358 | - "opened by tahinli" | |
| 359 | - ); | |
| 360 | - assert_eq!(activity_line(Lang::En, K::VerbUpdated, None), "updated"); | |
| 361 | - assert_eq!( | |
| 362 | - activity_line(Lang::Tr, K::VerbOpened, Some("tahinli")), | |
| 363 | - "tahinli tarafından açıldı" | |
| 364 | - ); | |
| 365 | - assert_eq!(activity_line(Lang::Tr, K::VerbUpdated, None), "Güncellendi"); | |
| 366 | - assert_eq!( | |
| 367 | - activity_line(Lang::En, K::VerbReviewRequested, Some("tahinli")), | |
| 368 | - "review requested by tahinli" | |
| 369 | - ); | |
| 370 | - assert_eq!( | |
| 371 | - activity_line(Lang::Tr, K::VerbReviewRequested, Some("tahinli")), | |
| 372 | - "tahinli tarafından inceleme istendi" | |
| 373 | - ); | |
| 374 | - } | |
| 375 | -} |
crates/forge-web-base/src/i18n/mod.rsmodified+0 -15
| @@ -494,21 +494,6 @@ mod tests { | ||
| 494 | 494 | use super::*; |
| 495 | 495 | use http::HeaderValue; |
| 496 | 496 | |
| 497 | - #[test] | |
| 498 | - fn every_key_has_text_in_both_languages() { | |
| 499 | - for key in ALL { | |
| 500 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English text"); | |
| 501 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish text"); | |
| 502 | - } | |
| 503 | - } | |
| 504 | - | |
| 505 | - #[test] | |
| 506 | - fn all_lists_each_key_once() { | |
| 507 | - for (i, key) in ALL.iter().enumerate() { | |
| 508 | - assert!(!ALL[i + 1..].contains(key), "{key:?} is listed twice"); | |
| 509 | - } | |
| 510 | - } | |
| 511 | - | |
| 512 | 497 | #[test] |
| 513 | 498 | fn stored_preference_then_browser_picks_the_language() { |
| 514 | 499 | let cases: [(&str, Option<&str>, &str, Lang); 10] = [ |
crates/forge-web-base/src/i18n/needs.rsmodified+0 -13
| @@ -19,16 +19,3 @@ strings! { | ||
| 19 | 19 | BackToNeedsYou => "Back to Needs you", "Sizi bekleyenlere dön"; |
| 20 | 20 | AllClear => "Nothing waiting.", "Sizi bekleyen bir şey yok."; |
| 21 | 21 | } |
| 22 | - | |
| 23 | -#[cfg(test)] | |
| 24 | -mod tests { | |
| 25 | - use super::*; | |
| 26 | - | |
| 27 | - #[test] | |
| 28 | - fn every_key_has_english_and_turkish() { | |
| 29 | - for key in ALL { | |
| 30 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 31 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 32 | - } | |
| 33 | - } | |
| 34 | -} |
crates/forge-web-base/src/i18n/orgs.rsmodified+0 -55
| @@ -203,58 +203,3 @@ pub fn updated_parts(lang: Lang) -> (&'static str, &'static str) { | ||
| 203 | 203 | Lang::Tr => (" \u{b7} ", " güncellendi"), |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | - | |
| 207 | -#[cfg(test)] | |
| 208 | -mod tests { | |
| 209 | - use super::*; | |
| 210 | - | |
| 211 | - #[test] | |
| 212 | - fn every_key_has_text_in_both_languages() { | |
| 213 | - for key in ALL { | |
| 214 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 215 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 216 | - } | |
| 217 | - } | |
| 218 | - | |
| 219 | - #[test] | |
| 220 | - fn turkish_differs_from_english_for_most_keys() { | |
| 221 | - let differing = ALL | |
| 222 | - .iter() | |
| 223 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 224 | - .count(); | |
| 225 | - assert!(differing >= 3, "only {differing} keys are translated"); | |
| 226 | - assert_eq!(t(Lang::Tr, K::NoTeamsYet), "Henüz takım yok."); | |
| 227 | - } | |
| 228 | - | |
| 229 | - #[test] | |
| 230 | - fn helpers_keep_the_english_sentences() { | |
| 231 | - assert_eq!( | |
| 232 | - coverage_text(Lang::En, "write", true), | |
| 233 | - "write on all repositories" | |
| 234 | - ); | |
| 235 | - assert_eq!( | |
| 236 | - coverage_text(Lang::En, "read", false), | |
| 237 | - "read on linked repositories" | |
| 238 | - ); | |
| 239 | - assert_eq!( | |
| 240 | - coverage_text(Lang::Tr, "read", false), | |
| 241 | - "bağlı depolarda okuma" | |
| 242 | - ); | |
| 243 | - assert_eq!(page_of(Lang::En, 2, 5), "Page 2 of 5"); | |
| 244 | - assert_eq!(updated_parts(Lang::En), (" \u{b7} updated ", "")); | |
| 245 | - assert_eq!(updated_parts(Lang::Tr), (" \u{b7} ", " güncellendi")); | |
| 246 | - assert_eq!(repo_count(Lang::En, 3), "3 repositories"); | |
| 247 | - assert_eq!(repo_count(Lang::En, 1), "1 repository"); | |
| 248 | - assert_eq!(repo_count(Lang::Tr, 1), "1 depo"); | |
| 249 | - assert_eq!(starred_count(Lang::En, 1), "1 starred repository"); | |
| 250 | - assert_eq!(starred_count(Lang::En, 2), "2 starred repositories"); | |
| 251 | - assert_eq!(starred_count(Lang::Tr, 2), "2 yıldızlı depo"); | |
| 252 | - assert_eq!(members_and_teams(Lang::En, 2, 1), "2 members \u{b7} 1 team"); | |
| 253 | - assert_eq!(members_and_teams(Lang::En, 1, 3), "1 member \u{b7} 3 teams"); | |
| 254 | - assert_eq!(type_to_confirm(Lang::En, "acme"), "Type acme to confirm"); | |
| 255 | - assert_eq!( | |
| 256 | - description_too_long(Lang::En, 2000), | |
| 257 | - "description must be at most 2000 characters" | |
| 258 | - ); | |
| 259 | - } | |
| 260 | -} |
crates/forge-web-base/src/i18n/pulls.rsmodified+0 -32
| @@ -104,35 +104,3 @@ pub fn list_title(lang: Lang, owner: &str, repo: &str) -> String { | ||
| 104 | 104 | Lang::Tr => format!("{owner}/{repo} \u{b7} Çekme istekleri"), |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - | |
| 108 | -#[cfg(test)] | |
| 109 | -mod tests { | |
| 110 | - use super::*; | |
| 111 | - | |
| 112 | - #[test] | |
| 113 | - fn every_key_has_both_languages() { | |
| 114 | - let mut differing = 0; | |
| 115 | - for &key in ALL { | |
| 116 | - let en = t(Lang::En, key); | |
| 117 | - let tr = t(Lang::Tr, key); | |
| 118 | - assert!(!en.is_empty(), "{key:?} has an empty English string"); | |
| 119 | - assert!(!tr.is_empty(), "{key:?} has an empty Turkish string"); | |
| 120 | - if en != tr { | |
| 121 | - differing += 1; | |
| 122 | - } | |
| 123 | - } | |
| 124 | - assert!(differing >= 3); | |
| 125 | - } | |
| 126 | - | |
| 127 | - #[test] | |
| 128 | - fn counted_strings_match_english() { | |
| 129 | - assert_eq!(comments(Lang::En, 1), "1 comment"); | |
| 130 | - assert_eq!(comments(Lang::En, 3), "3 comments"); | |
| 131 | - assert_eq!(comments(Lang::Tr, 3), "3 yorum"); | |
| 132 | - assert_eq!(commit_count(Lang::En, 1), "1 commit"); | |
| 133 | - assert_eq!(commit_count(Lang::En, 2), "2 commits"); | |
| 134 | - assert_eq!(tab_open(Lang::En, 2), "Open 2"); | |
| 135 | - assert_eq!(tab_open(Lang::Tr, 2), "Açık 2"); | |
| 136 | - assert_eq!(list_title(Lang::En, "a", "b"), "a/b \u{b7} Pull requests"); | |
| 137 | - } | |
| 138 | -} |
crates/forge-web-base/src/i18n/pulls_review.rsmodified+0 -15
| @@ -168,18 +168,3 @@ pub fn edit_title(lang: Lang, number: i64, repo: &str) -> String { | ||
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | - | |
| 172 | -#[cfg(test)] | |
| 173 | -mod tests { | |
| 174 | - use super::*; | |
| 175 | - | |
| 176 | - #[test] | |
| 177 | - fn counted_helpers_match_english_text() { | |
| 178 | - assert_eq!(commit_count_line(Lang::En, 1), "1 commit"); | |
| 179 | - assert_eq!(commit_count_line(Lang::En, 3), "3 commits"); | |
| 180 | - assert_eq!(commits_tab(Lang::En, 4), "Commits 4"); | |
| 181 | - assert_eq!(files_tab(Lang::En, 2), "Files changed 2"); | |
| 182 | - assert_eq!(approvals_of(Lang::En, 1, 2), "1 of 2 required approvals"); | |
| 183 | - assert_eq!(commit_count_line(Lang::Tr, 3), "3 commit’i"); | |
| 184 | - } | |
| 185 | -} |
crates/forge-web-base/src/i18n/releases_ci.rsmodified+0 -33
| @@ -190,36 +190,3 @@ pub fn upload_hint(lang: Lang, max_mb: impl Display) -> String { | ||
| 190 | 190 | ), |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | - | |
| 194 | -#[cfg(test)] | |
| 195 | -mod tests { | |
| 196 | - use super::*; | |
| 197 | - | |
| 198 | - #[test] | |
| 199 | - fn every_key_has_text_in_both_languages() { | |
| 200 | - for key in ALL { | |
| 201 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 202 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 203 | - } | |
| 204 | - } | |
| 205 | - | |
| 206 | - #[test] | |
| 207 | - fn turkish_differs_from_english_for_translated_keys() { | |
| 208 | - let differing = ALL | |
| 209 | - .iter() | |
| 210 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 211 | - .count(); | |
| 212 | - assert!(differing >= 3); | |
| 213 | - assert_eq!(t(Lang::Tr, K::Releases), "Sürümler"); | |
| 214 | - assert_eq!(t(Lang::En, K::Releases), "Releases"); | |
| 215 | - } | |
| 216 | - | |
| 217 | - #[test] | |
| 218 | - fn counted_sentences_read_in_both_languages() { | |
| 219 | - assert_eq!(download_count(Lang::En, 3), "3 downloads"); | |
| 220 | - assert_eq!(download_count(Lang::Tr, 3), "3 indirme"); | |
| 221 | - assert_eq!(download_count(Lang::En, 1), "1 download"); | |
| 222 | - assert_eq!(duration_minutes(Lang::En, 1, 5), "1m 5s"); | |
| 223 | - assert_eq!(duration_minutes(Lang::Tr, 1, 5), "1 dk 5 sn"); | |
| 224 | - } | |
| 225 | -} |
crates/forge-web-base/src/i18n/repo_admin.rsmodified+0 -22
| @@ -220,25 +220,3 @@ pub fn approvals_count(lang: Lang, n: u32) -> String { | ||
| 220 | 220 | Lang::Tr => format!("{n} gerekli onay"), |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | - | |
| 224 | -#[cfg(test)] | |
| 225 | -mod tests { | |
| 226 | - use super::*; | |
| 227 | - | |
| 228 | - #[test] | |
| 229 | - fn every_key_has_english_and_turkish() { | |
| 230 | - for key in ALL { | |
| 231 | - assert!(!t(Lang::En, *key).is_empty(), "{key:?} has no English"); | |
| 232 | - assert!(!t(Lang::Tr, *key).is_empty(), "{key:?} has no Turkish"); | |
| 233 | - } | |
| 234 | - } | |
| 235 | - | |
| 236 | - #[test] | |
| 237 | - fn turkish_differs_from_english() { | |
| 238 | - let differing = ALL | |
| 239 | - .iter() | |
| 240 | - .filter(|key| t(Lang::En, **key) != t(Lang::Tr, **key)) | |
| 241 | - .count(); | |
| 242 | - assert!(differing >= 3, "only {differing} keys differ"); | |
| 243 | - } | |
| 244 | -} |
crates/forge-web-base/src/i18n/server_settings.rsmodified+0 -26
| @@ -190,29 +190,3 @@ pub fn field_tr(key: &str) -> Option<(&'static str, &'static str)> { | ||
| 190 | 190 | _ => return None, |
| 191 | 191 | }) |
| 192 | 192 | } |
| 193 | - | |
| 194 | -#[cfg(test)] | |
| 195 | -mod tests { | |
| 196 | - use forge_core::server_settings::FIELDS; | |
| 197 | - | |
| 198 | - use super::*; | |
| 199 | - | |
| 200 | - #[test] | |
| 201 | - fn every_field_has_turkish_text() { | |
| 202 | - for field in FIELDS { | |
| 203 | - let (label, help) = | |
| 204 | - field_tr(field.key).unwrap_or_else(|| panic!("{} has no Turkish text", field.key)); | |
| 205 | - assert!( | |
| 206 | - !label.is_empty(), | |
| 207 | - "{} has an empty Turkish label", | |
| 208 | - field.key | |
| 209 | - ); | |
| 210 | - assert_eq!( | |
| 211 | - !help.is_empty(), | |
| 212 | - !field.help.is_empty(), | |
| 213 | - "{}: Turkish help presence differs from English", | |
| 214 | - field.key | |
| 215 | - ); | |
| 216 | - } | |
| 217 | - } | |
| 218 | -} |
crates/forge-web-base/src/render/highlight.rsmodified+0 -23
| @@ -251,32 +251,9 @@ mod tests { | ||
| 251 | 251 | assert!(highlight_lines("a.rs", &too_big).is_none()); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - #[test] | |
| 255 | - fn css_has_classes_and_dark_media_query() { | |
| 256 | - let css = highlight_css(); | |
| 257 | - assert!(css.contains(".hl-")); | |
| 258 | - assert!(css.contains("@media (prefers-color-scheme: dark)")); | |
| 259 | - assert!(css.contains(DARK_WHEN_AUTO)); | |
| 260 | - assert!(css.contains(DARK_WHEN_FORCED)); | |
| 261 | - assert!(!css.contains("@media (prefers-color-scheme: dark) {\n.hl-")); | |
| 262 | - } | |
| 263 | - | |
| 264 | 254 | #[test] |
| 265 | 255 | fn dark_rules_are_scoped_to_their_selectors() { |
| 266 | 256 | let scoped = scope_css(".hl-a,.hl-b {\n color: #fff;\n}\n", "S"); |
| 267 | 257 | assert_eq!(scoped, "S .hl-a, S .hl-b {\n color: #fff;\n}\n"); |
| 268 | 258 | } |
| 269 | - | |
| 270 | - #[test] | |
| 271 | - fn first_call_latency() { | |
| 272 | - let start = std::time::Instant::now(); | |
| 273 | - let _ = highlight_lines("first.rs", "fn a() {}\n"); | |
| 274 | - let first = start.elapsed(); | |
| 275 | - let css_start = std::time::Instant::now(); | |
| 276 | - let _ = highlight_css(); | |
| 277 | - let css = css_start.elapsed(); | |
| 278 | - println!( | |
| 279 | - "highlight first call (LazyLock init + highlight): {first:?}; css first call: {css:?}" | |
| 280 | - ); | |
| 281 | - } | |
| 282 | 259 | } |
crates/forge-web-base/src/theme.rsmodified+0 -7
| @@ -71,13 +71,6 @@ pub fn set_theme_cookie(cx: &Cx, theme: &str) { | ||
| 71 | 71 | mod tests { |
| 72 | 72 | use super::Theme; |
| 73 | 73 | |
| 74 | - #[test] | |
| 75 | - fn the_toggle_cycles_light_dark_auto_light() { | |
| 76 | - assert_eq!(Theme::Light.next(), Theme::Dark); | |
| 77 | - assert_eq!(Theme::Dark.next(), Theme::Auto); | |
| 78 | - assert_eq!(Theme::Auto.next(), Theme::Light); | |
| 79 | - } | |
| 80 | - | |
| 81 | 74 | #[test] |
| 82 | 75 | fn unknown_or_missing_preferences_fall_back_to_light() { |
| 83 | 76 | for stored in ["", "neon", "light"] { |
crates/forge-web/src/page_route_tests/notifications.rsmodified+0 -30
| @@ -138,21 +138,6 @@ async fn inbox_lists_unread_and_all_shows_read() { | ||
| 138 | 138 | assert!(all.body.contains("mentioned")); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | -#[tokio::test] | |
| 142 | -async fn unread_inbox_lists_unread_rows_grouped_by_repo() { | |
| 143 | - let site = site().await; | |
| 144 | - let w = world(&site, Visibility::Public).await; | |
| 145 | - let cookie = sign_in(&site.store, &w.bob.id, "bob-token").await; | |
| 146 | - notify(&site, &w, Reason::Assign).await; | |
| 147 | - | |
| 148 | - let page = get(&site, "/notifications", Some(&cookie)).await; | |
| 149 | - assert_eq!(page.status, 200); | |
| 150 | - assert!(page.body.contains("tahinli/demo #1 First")); | |
| 151 | - assert!(page.body.contains("assigned")); | |
| 152 | - assert!(page.body.contains("/notifications/mark_all_read?repo=")); | |
| 153 | - assert!(page.body.contains("Mark all as read")); | |
| 154 | -} | |
| 155 | - | |
| 156 | 141 | #[tokio::test] |
| 157 | 142 | async fn another_users_notification_is_404_and_the_owner_opens_it() { |
| 158 | 143 | let site = site().await; |
| @@ -237,21 +222,6 @@ async fn the_stream_sends_the_count_then_each_change() { | ||
| 237 | 222 | assert_eq!(&next[..], b"event: unread\ndata: 0\n\n"); |
| 238 | 223 | } |
| 239 | 224 | |
| 240 | -#[tokio::test] | |
| 241 | -async fn corner_bell_shows_the_unread_count() { | |
| 242 | - let site = site().await; | |
| 243 | - let w = world(&site, Visibility::Public).await; | |
| 244 | - let cookie = sign_in(&site.store, &w.bob.id, "bob-token").await; | |
| 245 | - | |
| 246 | - let none = get(&site, "/explore", Some(&cookie)).await; | |
| 247 | - assert!(none.body.contains("href=\"/notifications\"")); | |
| 248 | - assert!(!none.body.contains("<span class=\"bell-count\">")); | |
| 249 | - | |
| 250 | - notify(&site, &w, Reason::Mention).await; | |
| 251 | - let one = get(&site, "/explore", Some(&cookie)).await; | |
| 252 | - assert!(one.body.contains("<span class=\"bell-count\">1</span>")); | |
| 253 | -} | |
| 254 | - | |
| 255 | 225 | #[tokio::test] |
| 256 | 226 | async fn subscription_toggles_on_an_issue_and_unknown_pull_is_404() { |
| 257 | 227 | let site = site().await; |
crates/forge-web/src/page_route_tests/repo.rsmodified+0 -119
| @@ -86,81 +86,6 @@ async fn fixture(dir: &Path) -> (Router, AppState) { | ||
| 86 | 86 | (router, state) |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | -#[tokio::test] | |
| 90 | -async fn demo_pages_render_from_the_repo_contents() { | |
| 91 | - let dir = tempfile::tempdir().unwrap(); | |
| 92 | - let (router, _) = fixture(dir.path()).await; | |
| 93 | - | |
| 94 | - let (status, body) = get_as(&router, "/tahinli/demo", None).await; | |
| 95 | - assert_eq!(status, 200); | |
| 96 | - assert!(body.contains("Hello from the README"), "README rendered"); | |
| 97 | - assert!( | |
| 98 | - body.contains("/tahinli/demo/tree/main/src"), | |
| 99 | - "root tree listed" | |
| 100 | - ); | |
| 101 | - assert!( | |
| 102 | - body.contains("class=\"clone pop\""), | |
| 103 | - "clone popover rendered" | |
| 104 | - ); | |
| 105 | - assert!(body.contains("value=\"https://forge.test/tahinli/demo.git\"")); | |
| 106 | - assert!(body.contains("git@forge.test:tahinli/demo.git")); | |
| 107 | - assert!( | |
| 108 | - body.contains("readonly"), | |
| 109 | - "clone URLs are selectable, read-only fields" | |
| 110 | - ); | |
| 111 | - assert!(body.contains("/tahinli/demo/archive/main.tar.gz")); | |
| 112 | - assert!(body.contains("/tahinli/demo/branches")); | |
| 113 | - assert!(body.contains("data-ref-filter"), "branch switcher rendered"); | |
| 114 | - | |
| 115 | - let (status, body) = get_as(&router, "/tahinli/demo/tree/main/src", None).await; | |
| 116 | - assert_eq!(status, 200); | |
| 117 | - assert!(body.contains("main.rs")); | |
| 118 | - assert!(body.contains("/tahinli/demo/blob/main/src/main.rs")); | |
| 119 | - let (status, body) = get_as(&router, "/tahinli/demo/tree/main", None).await; | |
| 120 | - assert_eq!(status, 200); | |
| 121 | - assert!(body.contains("/tahinli/demo/tree/main/docs")); | |
| 122 | - | |
| 123 | - let (status, body) = get_as(&router, "/tahinli/demo/blob/main/src/main.rs", None).await; | |
| 124 | - assert_eq!(status, 200); | |
| 125 | - assert!(body.contains("id=\"L1\"")); | |
| 126 | - assert!(body.contains("href=\"#L2\"")); | |
| 127 | - assert!(body.contains("<span class="), "syntax classes applied"); | |
| 128 | - assert!(body.contains("/assets/highlight.css?v=")); | |
| 129 | - | |
| 130 | - let (status, body) = get_as(&router, "/tahinli/demo/blob/main/docs/guide.md", None).await; | |
| 131 | - assert_eq!(status, 200); | |
| 132 | - assert!( | |
| 133 | - body.contains("markdown-body") && body.contains("<table>"), | |
| 134 | - "GFM table rendered" | |
| 135 | - ); | |
| 136 | - let (status, body) = get_as( | |
| 137 | - &router, | |
| 138 | - "/tahinli/demo/blob/main/docs/guide.md?plain=1", | |
| 139 | - None, | |
| 140 | - ) | |
| 141 | - .await; | |
| 142 | - assert_eq!(status, 200); | |
| 143 | - assert!(body.contains("file-table"), "source shown as lines"); | |
| 144 | - assert!(!body.contains("markdown-body"), "not rendered"); | |
| 145 | - | |
| 146 | - let (status, body) = get_as(&router, "/tahinli/demo/blob/main/data.bin", None).await; | |
| 147 | - assert_eq!(status, 200); | |
| 148 | - assert!(body.contains("Binary file, 3 bytes")); | |
| 149 | - | |
| 150 | - let (status, body) = get_as(&router, "/tahinli/demo/branches", None).await; | |
| 151 | - assert_eq!(status, 200); | |
| 152 | - assert!(body.contains("default"), "default branch marked"); | |
| 153 | - let (status, body) = get_as(&router, "/tahinli/demo/tags", None).await; | |
| 154 | - assert_eq!(status, 200); | |
| 155 | - assert!(body.contains("Nothing here yet.")); | |
| 156 | - let (status, body) = get_as(&router, "/tahinli/demo/tree/main", None).await; | |
| 157 | - assert_eq!(status, 200); | |
| 158 | - assert!(body.contains("README.md")); | |
| 159 | - let (status, body) = get_as(&router, "/tahinli/demo", None).await; | |
| 160 | - assert_eq!(status, 200); | |
| 161 | - assert!(body.contains("Hello from the README")); | |
| 162 | -} | |
| 163 | - | |
| 164 | 89 | #[tokio::test] |
| 165 | 90 | async fn missing_paths_and_private_repos_are_404_for_anonymous() { |
| 166 | 91 | let dir = tempfile::tempdir().unwrap(); |
| @@ -258,50 +183,6 @@ async fn recent_push_banner_links_to_compare() { | ||
| 258 | 183 | assert!(body.contains("Compare & pull request"), "{body}"); |
| 259 | 184 | } |
| 260 | 185 | |
| 261 | -#[tokio::test] | |
| 262 | -async fn push_older_than_an_hour_shows_no_banner() { | |
| 263 | - let dir = tempfile::tempdir().unwrap(); | |
| 264 | - let (router, state) = fixture(dir.path()).await; | |
| 265 | - let demo = demo_repo(&state).await; | |
| 266 | - make_branch( | |
| 267 | - &repo_path(&state.config.data_dir, &demo.id).unwrap(), | |
| 268 | - "feature", | |
| 269 | - ); | |
| 270 | - record_push( | |
| 271 | - &state, | |
| 272 | - &demo.id, | |
| 273 | - &demo.owner_id, | |
| 274 | - "feature", | |
| 275 | - Duration::from_secs(7200), | |
| 276 | - ) | |
| 277 | - .await; | |
| 278 | - let cookie = sign_in(&state, &demo.owner_id, "tahinli-token").await; | |
| 279 | - | |
| 280 | - let (status, body) = get_as(&router, "/tahinli/demo", Some(&cookie)).await; | |
| 281 | - assert_eq!(status, 200); | |
| 282 | - assert!(!body.contains(BANNER), "{body}"); | |
| 283 | -} | |
| 284 | - | |
| 285 | -#[tokio::test] | |
| 286 | -async fn default_branch_push_shows_no_banner() { | |
| 287 | - let dir = tempfile::tempdir().unwrap(); | |
| 288 | - let (router, state) = fixture(dir.path()).await; | |
| 289 | - let demo = demo_repo(&state).await; | |
| 290 | - record_push( | |
| 291 | - &state, | |
| 292 | - &demo.id, | |
| 293 | - &demo.owner_id, | |
| 294 | - "main", | |
| 295 | - Duration::from_secs(300), | |
| 296 | - ) | |
| 297 | - .await; | |
| 298 | - let cookie = sign_in(&state, &demo.owner_id, "tahinli-token").await; | |
| 299 | - | |
| 300 | - let (status, body) = get_as(&router, "/tahinli/demo", Some(&cookie)).await; | |
| 301 | - assert_eq!(status, 200); | |
| 302 | - assert!(!body.contains(BANNER), "{body}"); | |
| 303 | -} | |
| 304 | - | |
| 305 | 186 | #[tokio::test] |
| 306 | 187 | async fn open_pull_request_suppresses_banner() { |
| 307 | 188 | let dir = tempfile::tempdir().unwrap(); |
crates/forge-web/src/templates_route_tests.rsmodified+0 -96
| @@ -39,25 +39,6 @@ fn tag_at(html: &str, needle: &str) -> String { | ||
| 39 | 39 | html[at..end].to_owned() |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -#[tokio::test] | |
| 43 | -async fn several_templates_show_a_chooser() { | |
| 44 | - let fx = setup(&[ | |
| 45 | - (".forge/ISSUE_TEMPLATE/bug.md", BUG), | |
| 46 | - (".forge/ISSUE_TEMPLATE/feature.md", FEATURE), | |
| 47 | - ]) | |
| 48 | - .await; | |
| 49 | - let reply = send(&fx.router, "GET", &new_issue_uri(""), true, None, &[]).await; | |
| 50 | - assert_eq!(reply.status, 200); | |
| 51 | - let html = reply.text(); | |
| 52 | - assert!(html.contains("Bug report")); | |
| 53 | - assert!(html.contains("Something broke")); | |
| 54 | - assert!(html.contains("issues/new?template=bug\"")); | |
| 55 | - assert!(html.contains("issues/new?template=feature\"")); | |
| 56 | - assert!(html.contains("Open a blank issue")); | |
| 57 | - assert!(html.contains("issues/new?blank=1\"")); | |
| 58 | - assert!(!html.contains("name=\"title\"")); | |
| 59 | -} | |
| 60 | - | |
| 61 | 42 | #[tokio::test] |
| 62 | 43 | async fn chosen_template_prefills_and_preselects_existing_labels() { |
| 63 | 44 | let fx = setup(&[ |
| @@ -119,48 +100,6 @@ async fn chosen_template_prefills_and_preselects_existing_labels() { | ||
| 119 | 100 | assert!(!tag_at(&html, &format!("value=\"{docs_id}\"")).contains("checked")); |
| 120 | 101 | } |
| 121 | 102 | |
| 122 | -#[tokio::test] | |
| 123 | -async fn blank_issue_from_chooser_is_empty() { | |
| 124 | - let fx = setup(&[ | |
| 125 | - (".forge/ISSUE_TEMPLATE/bug.md", BUG), | |
| 126 | - (".forge/ISSUE_TEMPLATE/feature.md", FEATURE), | |
| 127 | - ]) | |
| 128 | - .await; | |
| 129 | - let reply = send( | |
| 130 | - &fx.router, | |
| 131 | - "GET", | |
| 132 | - &new_issue_uri("?blank=1"), | |
| 133 | - true, | |
| 134 | - None, | |
| 135 | - &[], | |
| 136 | - ) | |
| 137 | - .await; | |
| 138 | - let html = reply.text(); | |
| 139 | - assert!(html.contains("name=\"title\"")); | |
| 140 | - assert!(!html.contains("Steps to reproduce")); | |
| 141 | - assert!(!html.contains("Choose a template")); | |
| 142 | -} | |
| 143 | - | |
| 144 | -#[tokio::test] | |
| 145 | -async fn single_template_prefills_without_chooser() { | |
| 146 | - let fx = setup(&[(".forge/ISSUE_TEMPLATE/bug.md", BUG)]).await; | |
| 147 | - let html = send(&fx.router, "GET", &new_issue_uri(""), true, None, &[]) | |
| 148 | - .await | |
| 149 | - .text(); | |
| 150 | - assert!(html.contains("value=\"[Bug]:\"")); | |
| 151 | - assert!(html.contains("## Steps to reproduce")); | |
| 152 | - assert!(!html.contains("Open a blank issue")); | |
| 153 | -} | |
| 154 | - | |
| 155 | -#[tokio::test] | |
| 156 | -async fn single_file_under_github_is_used_as_is() { | |
| 157 | - let fx = setup(&[(".github/ISSUE_TEMPLATE.md", "Plain body text\n")]).await; | |
| 158 | - let html = send(&fx.router, "GET", &new_issue_uri(""), true, None, &[]) | |
| 159 | - .await | |
| 160 | - .text(); | |
| 161 | - assert!(html.contains("Plain body text")); | |
| 162 | -} | |
| 163 | - | |
| 164 | 103 | #[tokio::test] |
| 165 | 104 | async fn chooser_lists_at_most_twenty_templates() { |
| 166 | 105 | let names: Vec<String> = (0..21).map(|n| format!("t{n:02}")).collect(); |
| @@ -228,38 +167,3 @@ async fn submitting_with_a_label_applies_it_to_the_issue() { | ||
| 228 | 167 | assert_eq!(labels.len(), 1); |
| 229 | 168 | assert_eq!(labels[0].name, "bug"); |
| 230 | 169 | } |
| 231 | - | |
| 232 | -#[tokio::test] | |
| 233 | -async fn compare_form_starts_with_the_pull_request_template() { | |
| 234 | - let fx = setup(&[( | |
| 235 | - ".forge/PULL_REQUEST_TEMPLATE.md", | |
| 236 | - "## Summary\n\nWhat changed?\n", | |
| 237 | - )]) | |
| 238 | - .await; | |
| 239 | - git(&fx.work, &["checkout", "-q", "-b", "feature"]); | |
| 240 | - std::fs::write(fx.work.join("feature.txt"), "feature\n").unwrap(); | |
| 241 | - git(&fx.work, &["add", "-A"]); | |
| 242 | - git(&fx.work, &["commit", "-q", "-m", "Add feature file"]); | |
| 243 | - git( | |
| 244 | - &fx.work, | |
| 245 | - &[ | |
| 246 | - "push", | |
| 247 | - "-q", | |
| 248 | - &fx.bare.to_string_lossy(), | |
| 249 | - "feature:refs/heads/feature", | |
| 250 | - ], | |
| 251 | - ); | |
| 252 | - git(&fx.work, &["checkout", "-q", "main"]); | |
| 253 | - | |
| 254 | - let reply = send( | |
| 255 | - &fx.router, | |
| 256 | - "GET", | |
| 257 | - &format!("/{OWNER}/{REPO}/compare/main...feature"), | |
| 258 | - true, | |
| 259 | - None, | |
| 260 | - &[], | |
| 261 | - ) | |
| 262 | - .await; | |
| 263 | - assert_eq!(reply.status, 200); | |
| 264 | - assert!(reply.text().contains("What changed?")); | |
| 265 | -} |