Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock appears to be broken in Add-VSTeamProject.Tests.ps1 #369

Closed
1 of 3 tasks
jhoneill opened this issue Oct 16, 2020 · 1 comment · Fixed by #410
Closed
1 of 3 tasks

Mock appears to be broken in Add-VSTeamProject.Tests.ps1 #369

jhoneill opened this issue Oct 16, 2020 · 1 comment · Fixed by #410

Comments

@jhoneill
Copy link
Contributor

Steps to reproduce

Sync with trunk, and confirm

> git log --oneline --decorate
58a5491 (HEAD -> trunk, tag: v7.1.2, upstream/trunk, origin/trunk, origin/HEAD) Updated change log
f95ce17 Fix #365 (#366)
7daec7c Fixing issue #360 (#368)
4ce0cbd Fixing issue #363 (#367)

In a clean PowerShell session (I'm on 7.0.3)

.\Tests\function\tests\add-VSTeamProject.Tests.ps1

Expected behavior

Success

Actual behavior

Starting discovery in 1 files.
Discovery finished in 285ms.
[-] VSTeamProject.Add-VSTeamProject.with tfvc should create project with tfvc 1.54s (1.48s|58ms)
 FormatException: The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 RuntimeException: The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 ParameterBindingValidationException: Cannot validate argument on parameter 'Name'. The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 at Add-VSTeamProject<Process>, C:\Users\P10506111\Documents\github\vsteam\Source\Public\Add-VSTeamProject.ps1:69
 at <ScriptBlock>, C:\Users\P10506111\Documents\github\vsteam\Tests\function\tests\Add-VSTeamProject.Tests.ps1:51
[-] VSTeamProject.Add-VSTeamProject with Agile.Should create project with Agile 185ms (182ms|2ms)
 FormatException: The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 RuntimeException: The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 ParameterBindingValidationException: Cannot validate argument on parameter 'Name'. The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 at Add-VSTeamProject<Process>, C:\Users\P10506111\Documents\github\vsteam\Source\Public\Add-VSTeamProject.ps1:69
 at <ScriptBlock>, C:\Users\P10506111\Documents\github\vsteam\Tests\function\tests\Add-VSTeamProject.Tests.ps1:74
[-] VSTeamProject.Add-VSTeamProject with CMMI.Should create project with CMMI 166ms (165ms|1ms)
 FormatException: The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 RuntimeException: The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 ParameterBindingValidationException: Cannot validate argument on parameter 'Name'. The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid.
 at Add-VSTeamProject<Process>, C:\Users\P10506111\Documents\github\vsteam\Source\Public\Add-VSTeamProject.ps1:69
 at <ScriptBlock>, C:\Users\P10506111\Documents\github\vsteam\Tests\function\tests\Add-VSTeamProject.Tests.ps1:94
Tests completed in 4.11s
Tests Passed: 1, Failed: 3, Skipped: 0 NotRun: 0

Past experience says The format of value 'Module/ (Windows) PowerShell/7.0.3' is invalid. happens when a call which should be mocked makes it all the way through to Invoke-RestMethod

Environment data

OS

  • macOS
  • Windows
  • Linux
> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      7.0.3
PSEdition                      Core
GitCommitId                    7.0.3
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
@jhoneill
Copy link
Contributor Author

Line 21 of the tests file.
$Uri -like "*$top=100*" -and`
Top is no longer set to fix #363

Lines20 -24 of the test work if they're changed to this

      Mock Invoke-RestMethod { return [pscustomobject]@{value=@()} } -ParameterFilter {
         $Uri -like "*stateFilter=WellFormed*"
      }

jhoneill pushed a commit to jhoneill/vsteam that referenced this issue Oct 19, 2020
…ist process template in user/system environment.
SebastianSchuetze added a commit to RazorSPoint/vsteam that referenced this issue Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant