From 8adffbb2e2cbd95af94f6cb8a7fc6aa8849a9936 Mon Sep 17 00:00:00 2001 From: George Fleming Date: Fri, 5 Feb 2016 16:31:58 -0800 Subject: [PATCH] Fix HOMEPATH and Wait-Event tests On Windows, HOMEPATH is not necessarily `\Users\username`, so the test was made to match more loosely. Wait-Event's timeout varied more than expected, so the test's range was increased. --- test/powershell/Environment-Variables.Tests.ps1 | 4 ++-- test/powershell/Wait-Event.Tests.ps1 | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/powershell/Environment-Variables.Tests.ps1 b/test/powershell/Environment-Variables.Tests.ps1 index 01ce011f4..c5d6cc4eb 100644 --- a/test/powershell/Environment-Variables.Tests.ps1 +++ b/test/powershell/Environment-Variables.Tests.ps1 @@ -23,8 +23,8 @@ It "Should have the correct HOME" { if ($isWindows) { - $expected = "\Users\" + $ENV:USERNAME - $ENV:HOMEPATH | Should Be $expected + $expected = "\Users" + Split-Path $ENV:HOMEPATH -Parent | Should Be $expected } else { diff --git a/test/powershell/Wait-Event.Tests.ps1 b/test/powershell/Wait-Event.Tests.ps1 index c7cd185cf..771d0b428 100644 --- a/test/powershell/Wait-Event.Tests.ps1 +++ b/test/powershell/Wait-Event.Tests.ps1 @@ -8,7 +8,8 @@ Describe "Wait-Event" { # raised because it is fake Wait-Event -Timeout 1 -SourceIdentifier "FakeEvent" $stopwatch.Stop() - $stopwatch.ElapsedMilliseconds | Should BeGreaterThan 999 + $stopwatch.ElapsedMilliseconds | Should BeGreaterThan 500 + $stopwatch.ElapsedMilliseconds | Should BeLessThan 1500 } } }