Tests/tools/Get-DefectSuite.Tests.ps1

. "$PSScriptRoot/../../src/tools/Get-DefectSuite.ps1"

$ds = Get-Content "$PSScriptRoot/../data/DS0002/DS0002.yml" | ConvertFrom-Yaml
$de = Get-Content "$PSScriptRoot/../data/DS0002/DE00100.yml" | ConvertFrom-Yaml

# Remove-Module "$ModuleName"
# Import-Module $ModuleManifest -Force -ErrorAction Stop

# $dsId = "DS4404"
# getDsDataFromDsId($dsId)
# | dsDataToRefUrl
# | getDsFullFromRefUrl
# | dsFullToDefect
# | mapToDevDefect
# | defectToYamlFile

Describe 'Maps DefectSuite to Defect' {
    It 'should map DefectSuite to Defect' {
        $ds.Defects.Count.Should().Be($de.Defects.Count)
        $ds.Defects.ForEach {
            $ds.Defects.Should().Contain($_)
        }
    }
}




Describe 'Test-Get-DefectSuite' {
    It 'Get DS description' {
        {Get-DefectSuite "DS2820" -pull} 
        | Should -Not -BeNullOrEmpty
    }
}
Describe 'Gets-DefectSuites-defects' {
    It 'Should-not-throw' {
        getDsDefects(515052721804)
        | Should -Not -BeNullOrEmpty
    }
}
Describe 'Test DefectResponse deserialization' {
    It 'Should not throw' {
        getDsDefects(515052721804)
        | defectResponseToDefect 
        | Should -Not -BeNullOrEmpty
    }
}

Describe 'Cast Defect Response as Defect' {
    It 'Should be a Defect' {
        $true
    }
}