File tree Expand file tree Collapse file tree 3 files changed +61
-3
lines changed
Expand file tree Collapse file tree 3 files changed +61
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ function Get-SWAPISpecies {
88 process {
99 $invokeSwapiReqParams = @ {
1010 Method = ' Get'
11- Path = ' species'
11+ Path = ' species'
1212 }
1313
1414 if ($PSBoundParameters.ContainsKey (' Name' )) {
Original file line number Diff line number Diff line change 1+ BeforeAll {
2+ Import-Module $PSScriptRoot / ../ src/ PSSWAPI.psd1 - Force
3+ }
4+
5+ Describe ' Get-SWAPIFilm' {
6+ Context ' When no parameters are passed' {
7+ BeforeAll {
8+ Mock - ModuleName PSSWAPI Get-SWAPIFilm {
9+ return @ (
10+ @ {
11+ ' Title' = ' A New Hope'
12+ ' Episode' = 4
13+ ' Opening Crawl' = ' It is a period of civil war.…'
14+ ' Director' = ' George Lucas'
15+ ' Release Date' = ' 1977-05-25'
16+ }
17+ @ {
18+ ' Title' = ' The Empire Strikes Back'
19+ ' Episode' = 5
20+ ' Opening Crawl' = ' It is a dark time for the…'
21+ ' Director' = ' Irvin Kershner'
22+ ' Release Date' = ' 1980-05-17'
23+ }
24+ )
25+ }
26+ $result = Get-SWAPIFilm
27+ }
28+
29+ It ' Returns more than 1 movie' {
30+ ($result | Measure-Object ).Count | Should - BeGreaterThan 1
31+ }
32+ }
33+
34+ Context ' When "Title" parameter is passed' {
35+ BeforeAll {
36+ Mock - ModuleName PSSWAPI Get-SWAPIFilm - Verifiable - ParameterFilter { $Title -eq ' The Empire Strikes Back' } {
37+ return @ (
38+ @ {
39+ ' Title' = ' The Empire Strikes Back'
40+ ' Episode' = 5
41+ ' Opening Crawl' = ' It is a dark time for the…'
42+ ' Director' = ' Irvin Kershner'
43+ ' Release Date' = ' 1980-05-17'
44+ }
45+ )
46+ }
47+ $result = Get-SWAPIFilm - Title ' The Empire Strikes Back'
48+ }
49+
50+ It ' Returns more than 1 movie' {
51+ ($result | Measure-Object ).Count | Should - Be 1
52+ }
53+
54+ It ' Returns the movie matching the title' {
55+ $result.Title | Should - Be ' The Empire Strikes Back'
56+ }
57+ }
58+ }
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ Describe 'Module Structure and Syntax' {
6868 }
6969 }
7070
71- Context " Function Syntax - <_.BaseName>" - ForEach $functionsAll {
71+ Context " Function Syntax: <_.BaseName>" - ForEach $functionsAll {
7272
7373 It ' has no syntax errors' {
7474
@@ -82,7 +82,7 @@ Describe 'Module Structure and Syntax' {
8282 }
8383 }
8484
85- Context " Public Function Exported - <_.BaseName>" - ForEach $functionsPublic {
85+ Context " Public Function Exported: <_.BaseName>" - ForEach $functionsPublic {
8686
8787 It ' is exported in the module manifest' {
8888 $manifest.ExportedCommands.Keys.GetEnumerator () -contains $_.BaseName | Should - Be $true
You can’t perform that action at this time.
0 commit comments