Skip to content

Commit 2b2a8f8

Browse files
🧪 Test: Source file change detection (src/**) (#19)
## Summary This PR tests the important file changes detection by modifying a source file (`src/**`). ## What changed - Added optional `Name` parameter to `Get-Greeting` function - Updated documentation with new example ## Expected behavior Since this PR changes `src/functions/public/Get-Greeting.ps1` (which matches `^src/` pattern), the `HasImportantChanges` should be `true` and build/test stages **should run**. ## Verification Check the workflow run logs for: 1. "Check for Important File Changes" log group 2. Changed file `src/functions/public/Get-Greeting.ps1` detected 3. `HasImportantChanges: True` in the output 4. Build and test jobs should run
1 parent 619d5c5 commit 2b2a8f8

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

src/functions/public/Get-Greeting.ps1

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
.DESCRIPTION
77
Returns a simple greeting message for the specified time of day.
8+
Optionally includes the user's name in the greeting.
89
910
.EXAMPLE
1011
Get-Greeting -TimeOfDay 'Morning'
@@ -16,6 +17,11 @@
1617
1718
Returns "Good Evening!" to the user.
1819
20+
.EXAMPLE
21+
Get-Greeting -TimeOfDay 'Morning' -Name 'Alice'
22+
23+
Returns "Good Morning, Alice!" to the user.
24+
1925
.LINK
2026
https://MariusStorhaug.github.io/MariusTestModule/Functions/Get-Greeting/
2127
#>
@@ -25,7 +31,15 @@
2531
# The time of day for the greeting.
2632
[Parameter()]
2733
[ValidateSet('Morning', 'Afternoon', 'Evening')]
28-
[string] $TimeOfDay = 'Morning'
34+
[string] $TimeOfDay = 'Morning',
35+
36+
# Optional name to include in the greeting.
37+
[Parameter()]
38+
[string] $Name
2939
)
30-
"Good $TimeOfDay!"
40+
if ($Name) {
41+
"Good $TimeOfDay, $Name!"
42+
} else {
43+
"Good $TimeOfDay!"
44+
}
3145
}

tests/PSModuleTest.Tests.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ Describe 'Module' {
2222
Get-Greeting -TimeOfDay 'Evening' | Should -Be 'Good Evening!'
2323
}
2424

25+
It 'Function: Get-Greeting - With Name' {
26+
Get-Greeting -Name 'Alice' | Should -Be 'Good Morning, Alice!'
27+
}
28+
29+
It 'Function: Get-Greeting - Evening with Name' {
30+
Get-Greeting -TimeOfDay 'Evening' -Name 'Bob' | Should -Be 'Good Evening, Bob!'
31+
}
32+
33+
It 'Function: Get-Greeting - Afternoon with Name' {
34+
Get-Greeting -TimeOfDay 'Afternoon' -Name 'Charlie' | Should -Be 'Good Afternoon, Charlie!'
35+
}
36+
2537
It 'Function: Get-CurrentDateTime - Default format' {
2638
$result = Get-CurrentDateTime
2739
$result | Should -Match '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$'

0 commit comments

Comments
 (0)