-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexecutable_name_config_test.rs
More file actions
88 lines (79 loc) · 2.4 KB
/
Copy pathexecutable_name_config_test.rs
File metadata and controls
88 lines (79 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use indoc::indoc;
use predicates::prelude::*;
use std::error::Error;
mod common;
use common::OutputStream;
use common::run_codeowners;
#[test]
fn test_validate_with_custom_executable_name() -> Result<(), Box<dyn Error>> {
// When executable_name is configured, error should show that command
run_codeowners(
"custom_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::str::contains("Run `bin/codeownership validate`"),
)?;
Ok(())
}
#[test]
fn test_validate_with_default_executable_name() -> Result<(), Box<dyn Error>> {
// When executable_name is not configured, error should show default "codeowners"
run_codeowners(
"default_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::str::contains("Run `codeowners generate`"),
)?;
Ok(())
}
#[test]
fn test_custom_executable_name_full_error_message() -> Result<(), Box<dyn Error>> {
// Verify the complete error message format with custom executable
run_codeowners(
"custom_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::eq(indoc! {r#"
The following changes are required (- current, + expected):
-# Outdated content to trigger validation error
-/app/old.rb @FooTeam
+
+# Annotations at the top of file
+/app/foo.rb @FooTeam
+
+# Team-specific owned globs
+/ruby/app/payments/** @PaymentTeam
+
+# Team YML ownership
+/config/teams/foo.yml @FooTeam
+/config/teams/payments.yml @PaymentTeam
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
"#}),
)?;
Ok(())
}
#[test]
fn test_default_executable_name_full_error_message() -> Result<(), Box<dyn Error>> {
// Verify the complete error message format with default executable
run_codeowners(
"default_executable_name",
&["validate"],
false,
OutputStream::Stdout,
predicate::eq(indoc! {r#"
The following changes are required (- current, + expected):
-# Outdated content to trigger validation error
-/app/old.rb @BarTeam
+# Annotations at the top of file
+/app/bar.rb @BarTeam
+
+# Team YML ownership
+/config/teams/bar.yml @BarTeam
CODEOWNERS out of date. Run `codeowners generate` to update the CODEOWNERS file
"#}),
)?;
Ok(())
}