mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 15:00:07 +00:00
test(windows): cover versioned install flow
This commit is contained in:
@@ -107,6 +107,12 @@ Describe "Developer Tools Cleanup Module" {
|
||||
Get-Command Clear-GoCaches -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context "mise Cleanup" {
|
||||
It "Should have mise cache cleanup function" {
|
||||
Get-Command Clear-MiseCache -ErrorAction SilentlyContinue | Should -Not -BeNullOrEmpty
|
||||
}
|
||||
}
|
||||
|
||||
Context "Rust Cleanup" {
|
||||
It "Should have Rust cache cleanup function" {
|
||||
|
||||
@@ -5,6 +5,7 @@ BeforeAll {
|
||||
# Get the windows directory path (tests are in windows/tests/)
|
||||
$script:WindowsDir = Split-Path -Parent $PSScriptRoot
|
||||
$script:BinDir = Join-Path $script:WindowsDir "bin"
|
||||
$script:InstallScript = Join-Path $script:WindowsDir "install.ps1"
|
||||
}
|
||||
|
||||
Describe "Clean Command" {
|
||||
@@ -177,3 +178,41 @@ Describe "Main Entry Point" {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Installer Script" {
|
||||
Context "Version Source" {
|
||||
It "Should read the version from VERSION" {
|
||||
$source = Get-Content $script:InstallScript -Raw
|
||||
$source | Should -Match "version\.ps1"
|
||||
$source | Should -Match "Get-MoleVersionString -RootDir \$script:SourceDir"
|
||||
}
|
||||
}
|
||||
|
||||
Context "Optional TUI Tools" {
|
||||
It "Should downgrade TUI setup errors to warnings" {
|
||||
$source = Get-Content $script:InstallScript -Raw
|
||||
$source | Should -Match "Ensure-TuiBinary"
|
||||
$source | Should -Match "Skipping .*non-fatal setup error"
|
||||
$source | Should -Match "Could not prepare .*Install Go or wait for a Windows prerelease asset"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Source Install Hygiene" {
|
||||
Context ".gitattributes" {
|
||||
It "Should normalize tracked line endings for Windows source installs" {
|
||||
$source = Get-Content (Join-Path $script:WindowsDir ".gitattributes") -Raw
|
||||
$source | Should -Match '\* text=auto eol=lf'
|
||||
$source | Should -Match '\*\.ps1 text eol=lf'
|
||||
$source | Should -Match '\*\.cmd text eol=crlf'
|
||||
}
|
||||
}
|
||||
|
||||
Context ".gitignore" {
|
||||
It "Should ignore generated launcher batch files" {
|
||||
$source = Get-Content (Join-Path $script:WindowsDir ".gitignore") -Raw
|
||||
$source | Should -Match '(?m)^mole\.cmd$'
|
||||
$source | Should -Match '(?m)^mo\.cmd$'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,15 @@ BeforeAll {
|
||||
# Get the windows directory path (tests are in windows/tests/)
|
||||
$script:WindowsDir = Split-Path -Parent $PSScriptRoot
|
||||
$script:LibDir = Join-Path $script:WindowsDir "lib"
|
||||
$script:VersionFile = Join-Path $script:WindowsDir "VERSION"
|
||||
|
||||
# Import core modules
|
||||
. "$script:LibDir\core\base.ps1"
|
||||
. "$script:LibDir\core\log.ps1"
|
||||
. "$script:LibDir\core\ui.ps1"
|
||||
. "$script:LibDir\core\file_ops.ps1"
|
||||
. "$script:LibDir\core\version.ps1"
|
||||
. "$script:LibDir\core\tui_binaries.ps1"
|
||||
}
|
||||
|
||||
Describe "Base Module" {
|
||||
@@ -240,3 +243,17 @@ Describe "UI Module" {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Version Helpers" {
|
||||
Context "Shared VERSION Source" {
|
||||
It "Should read the version from VERSION" {
|
||||
$expected = (Get-Content $script:VersionFile -Raw).Trim()
|
||||
Get-MoleVersionString -RootDir $script:WindowsDir | Should -Be $expected
|
||||
}
|
||||
|
||||
It "Should keep TUI release lookup aligned with VERSION" {
|
||||
$expected = (Get-Content $script:VersionFile -Raw).Trim()
|
||||
Get-MoleVersionFromScriptFile -WindowsDir $script:WindowsDir | Should -Be $expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user