test/test/Invoke-TestSuiteRunner.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
using module ..\.\TestRunnerSupportModule.psm1

Describe "Test Invoke-TestSuiteRunner" {
    BeforeAll {
        $TestSupportModule = [TestRunnerSupportModule]::new('MockModuleB')
    }
    
    AfterAll {
        $TestSupportModule.Teardown()
    }
    
    Context "Call Invoke-TestSuiteRunner with request 'Path' value" {

        It "Should of called Start-Job which in-turn calls Invoke-Pester" {

            Mock Start-Job {} -ModuleName PowerBolt

            Invoke-TestSuiteRunner -Path ($TestSupportModule.MockDirectoryPath)
            
            Assert-MockCalled Start-Job -ParameterFilter {
                $Name -eq "JobPester"
            } -ModuleName PowerBolt -Times 1
            
            Assert-MockCalled Start-Job -ParameterFilter {
                $ArgumentList[0].Script -like '*io*'
            } -ModuleName PowerBolt -Times 1
        }
    }
}