-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathobs-powershell.tests.ps1
37 lines (32 loc) · 1.23 KB
/
obs-powershell.tests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
describe "obs-powershell" {
it "Lets you control OBS from PowerShell" {
Get-OBSMonitor -PassThru |
Select-Object -ExpandProperty requestID |
Should -BeLike GetMonitorList*
}
it 'Has lots of OBS websocket commands' {
Get-Command -Name *-OBS* |
Measure-Object |
Select-Object -ExpandProperty Count |
Should -BeGreaterThan 100
}
it 'Communicates requests in a predictable way' {
$allRequestCommands = Get-Command -Name *-OBS* |
Where-Object {
$_.ScriptBlock.Attributes.Key -contains 'OBS.WebSocket.RequestType'
}
$allEasyCommands = $allRequestCommands |
Where-Object {
($_ | Get-Command -Syntax) -match "$($_.Name) \[-PassThru\]"
}
foreach ($command in $allEasyCommands) {
$requestType = foreach ($attr in $command.ScriptBlock.Attributes) {
if ($attr.Key -eq 'OBS.WebSocket.RequestType') {
$attr.Value;break
}
}
$cmdOut = & $command -PassThru
$cmdOut | Select-Object -ExpandProperty RequestID | Should -belike "$requestType*"
}
}
}