Skip to content

Commit 39faaef

Browse files
Marius StorhaugMarius Storhaug
authored andcommitted
test: E2E for Import-TestData, section docs, and versioning
Point CI at PSModule/Process-PSModule@feat/import-testdata. Push a masked secret (TEST_SECRET) and a non-masked variable (TEST_VARIABLE) into the module test jobs via TestData, asserted in tests/Environment.Tests.ps1. Reorganize public functions into sections (Greetings/ with a named landing page, DateAndTime/ with an index.md landing page) to show documentation on the section nodes, leaving Get-PSModuleTest at the top level.
1 parent 52c883f commit 39faaef

6 files changed

Lines changed: 52 additions & 3 deletions

File tree

.github/workflows/Process-PSModule.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ permissions:
2727

2828
jobs:
2929
Process-PSModule:
30-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@60bdf8a5a4c92c53fcf2a8d23f7d5f5c93e6864e # v5.4.3
30+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@feat/import-testdata # E2E: temporary branch ref for the Import-TestData test
3131
secrets:
3232
APIKey: ${{ secrets.APIKey }}
33+
# E2E: push a secret (masked in logs) and a variable (not masked) into the module test jobs.
34+
# Import-TestData exposes each entry as $env:<name>; asserted in tests/Environment.Tests.ps1.
35+
TestData: >-
36+
{ "secrets": { "TEST_SECRET": "${{ secrets.TEST_SECRET }}" },
37+
"variables": { "TEST_VARIABLE": ${{ toJSON(vars.TEST_VARIABLE) }} } }

src/functions/public/Get-CurrentDateTime.ps1 renamed to src/functions/public/DateAndTime/Get-CurrentDateTime.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
Returns the current date in a custom format like "Monday, January 20, 2026".
2424
2525
.LINK
26-
https://MariusStorhaug.github.io/MariusTestModule/Functions/Get-CurrentDateTime/
26+
https://MariusStorhaug.github.io/MariusTestModule/Functions/DateAndTime/Get-CurrentDateTime/
2727
#>
2828
[OutputType([string])]
2929
[CmdletBinding()]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Date and Time
2+
3+
Functions for retrieving and formatting the current date and time.
4+
5+
This section's landing page is provided by an `index.md` file. When Process-PSModule builds the
6+
documentation site, this page becomes the landing page for the **Date and Time** group in the
7+
navigation on GitHub Pages.

src/functions/public/Get-Greeting.ps1 renamed to src/functions/public/Greetings/Get-Greeting.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
Returns "Good Morning, Alice!" to the user.
2424
2525
.LINK
26-
https://MariusStorhaug.github.io/MariusTestModule/Functions/Get-Greeting/
26+
https://MariusStorhaug.github.io/MariusTestModule/Functions/Greetings/Get-Greeting/
2727
#>
2828
[OutputType([string])]
2929
[CmdletBinding()]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Greetings
2+
3+
Functions for composing greeting messages.
4+
5+
This section's landing page is provided by a file named after its folder (`Greetings.md`). When
6+
Process-PSModule builds the documentation site, this page becomes the landing page for the
7+
**Greetings** group in the navigation on GitHub Pages.

tests/Environment.Tests.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
2+
'PSReviewUnusedParameter', '',
3+
Justification = 'Required for Pester tests'
4+
)]
5+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
6+
'PSUseDeclaredVarsMoreThanAssignments', '',
7+
Justification = 'Required for Pester tests'
8+
)]
9+
[CmdletBinding()]
10+
param()
11+
12+
Describe 'TestData is pushed into the module tests' {
13+
# TEST_SECRET (from the "secrets" map, masked) and TEST_VARIABLE (from the "variables" map, not
14+
# masked) are public non-secret fixtures that exist only to prove the calling workflow can push
15+
# secrets and variables into the module test jobs. The calling workflow passes them through a
16+
# single TestData object and Import-TestData (from Install-PSModuleHelpers) exposes them as
17+
# environment variables; these tests confirm they arrive with the expected values.
18+
19+
It 'Exposes the secret from the "secrets" map' {
20+
$actual = [System.Environment]::GetEnvironmentVariable('TEST_SECRET')
21+
$actual | Should -Not -BeNullOrEmpty
22+
$actual | Should -BeExactly 'mariustestmodule-secret-fixture-value'
23+
}
24+
25+
It 'Exposes the variable from the "variables" map' {
26+
$actual = [System.Environment]::GetEnvironmentVariable('TEST_VARIABLE')
27+
$actual | Should -Not -BeNullOrEmpty
28+
$actual | Should -BeExactly 'mariustestmodule-variable-fixture-value'
29+
}
30+
}

0 commit comments

Comments
 (0)