forked from majkinetor/au
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge Streams and StreamsDetails property in AUPackage + add tests on it
- Loading branch information
Thomas Démoulins
committed
Nov 9, 2017
1 parent
ce04036
commit 25ad3a4
Showing
7 changed files
with
118 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
remove-module AU -ea ignore | ||
import-module $PSScriptRoot\..\AU | ||
|
||
Describe 'AUPackage' -Tag aupackage { | ||
InModuleScope AU { | ||
It 'throws an error when intanciating without a path' { | ||
{ [AUPackage]::new('') } | Should Throw 'empty' | ||
} | ||
|
||
It 'throws an error when intanciating without a hashtable' { | ||
{ [AUPackage]::new([hashtable] $null) } | Should Throw 'empty' | ||
} | ||
|
||
It 'can serialize and deserialize' { | ||
$expected = @{ | ||
Path = 'path' | ||
Name = 'name' | ||
Updated = $true | ||
Pushed = $true | ||
RemoteVersion = '1.2.3' | ||
NuspecVersion = '0.1.2' | ||
Result = 'result1,result2,result3' -split ',' | ||
Error = 'error' | ||
NuspecPath = 'nuspecPath' | ||
Ignored = $true | ||
IgnoreMessage = 'ignoreMessage' | ||
StreamsPath = 'streamsPath' | ||
Streams = [PSCustomObject] @{ | ||
'0.1' = @{ | ||
NuspecVersion = '0.1.2' | ||
Path = 'path' | ||
Name = 'name' | ||
Updated = $true | ||
RemoteVersion = '1.2.3' | ||
} | ||
'0.2' = @{ | ||
NuspecVersion = '0.2.2' | ||
Path = 'path' | ||
Name = 'name' | ||
Updated = $true | ||
RemoteVersion = '1.2.3' | ||
} | ||
} | ||
} | ||
|
||
$package = [AUPackage]::new($expected) | ||
$actual = $package.Serialize() | ||
|
||
$expected.Keys | ? { $_ -ne 'Streams' } | % { | ||
$actual.$_ | Should Be $expected.$_ | ||
} | ||
$expected.Streams.psobject.Properties | % { | ||
$actual.Streams.$_ | Should Be $expected.Streams.$_ | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters