@@ -123,29 +123,31 @@ Describe "Build-Module" {
123123 Push-Location TestDrive:/ - StackName BuildModuleTest
124124 New-Item - ItemType Directory - Path TestDrive:/ Output/ MyModule/ 1.0 .0 / - Force
125125
126- Mock ConvertToAst {
127- [PSCustomObject ]@ {
128- PSTypeName = " PoshCode.ModuleBuilder.ParseResults"
129- ParseErrors = $null
130- Tokens = $null
131- AST = { }.AST
126+
127+ InModuleScope ModuleBuilder {
128+ Mock ConvertToAst {
129+ [PSCustomObject ]@ {
130+ PSTypeName = " PoshCode.ModuleBuilder.ParseResults"
131+ ParseErrors = $null
132+ Tokens = $null
133+ AST = { }.AST
134+ }
132135 }
133- }
134- Mock GetCommandAlias { @ { ' Get-MyInfo ' = @ ( ' GMI ' ) } }
135- Mock InitializeBuild {
136- # These are actually all the values that we need
137- [ PSCustomObject ] @ {
138- OutputDirectory = " TestDrive:/Output "
139- Name = " MyModule "
140- Version = [ Version ] " 1.0.0 "
141- Target = " CleanBuild "
142- ModuleBase = " TestDrive:/MyModule/ "
143- CopyDirectories = @ ()
144- Encoding = " UTF8 "
145- PublicFilter = " Public/*.ps1 "
136+ Mock Update-AliasesToExport
137+ Mock InitializeBuild {
138+ # These are actually all the values that we need
139+ [ PSCustomObject ] @ {
140+ OutputDirectory = " TestDrive:/Output "
141+ Name = " MyModule "
142+ Version = [ Version ] " 1.0.0 "
143+ Target = " CleanBuild "
144+ ModuleBase = " TestDrive:/MyModule/ "
145+ CopyDirectories = @ ()
146+ Encoding = " UTF8 "
147+ PublicFilter = " Public/*.ps1 "
148+ }
146149 }
147150 }
148-
149151 Mock Push-Location {}
150152
151153 # So it doesn't have to exist
@@ -181,7 +183,7 @@ Describe "Build-Module" {
181183 Assert-MockCalled ConvertToAst - Scope Context
182184 }
183185
184- It " Should call Move-UsingStatement to move the using statements, just in case " {
186+ It " Should call Move-UsingStatement to move the using statements" {
185187 Assert-MockCalled Move-UsingStatement - Parameter {
186188 $AST.Extent.Text -eq " { }"
187189 } - Scope Context
@@ -197,10 +199,10 @@ Describe "Build-Module" {
197199 } - Scope Context
198200 }
199201
200- It " Should call Update-Metadata to set the AliasesToExport " {
201- Assert-MockCalled Update-Metadata - Parameter {
202- $PropertyName -eq " AliasesToExport "
203- } - Scope Context
202+ It " Should call Update-AliasesToExport to update aliases " {
203+ Assert-MockCalled Update-AliasesToExport - Parameter {
204+ $AST .Extent.Text -eq " { } "
205+ }
204206 }
205207 }
206208
0 commit comments