fiftyone.geolocation 4.2.1 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.gitmodules +3 -0
  2. package/README.md +2 -2
  3. package/ci/README.md +2 -0
  4. package/ci/build-and-test.yml +34 -0
  5. package/ci/common-ci/.github/labels.yml +59 -0
  6. package/ci/common-ci/.github/workflows/sync-labels.yml +49 -0
  7. package/ci/common-ci/CiTips.md +34 -0
  8. package/ci/common-ci/GitVersion.yml +18 -0
  9. package/ci/common-ci/LICENSE +286 -0
  10. package/ci/common-ci/README.md +365 -0
  11. package/ci/common-ci/build-and-test.yml +65 -0
  12. package/ci/common-ci/check-merge-commit-format.yml +50 -0
  13. package/ci/common-ci/cloud-release-config.json +51 -0
  14. package/ci/common-ci/create-tag.yml +41 -0
  15. package/ci/common-ci/deploy.yml +25 -0
  16. package/ci/common-ci/dotnet/shared-code-signing-steps.yml +20 -0
  17. package/ci/common-ci/dotnet/shared-extract-and-publish-packages.yml +29 -0
  18. package/ci/common-ci/go/shared-go-list-stage.yml +64 -0
  19. package/ci/common-ci/java/readme.md +22 -0
  20. package/ci/common-ci/java/shared-code-signing-steps.yml +17 -0
  21. package/ci/common-ci/node/shared-extract-and-publish-packages.yml +26 -0
  22. package/ci/common-ci/php/readme.md +15 -0
  23. package/ci/common-ci/release-config-schema.json +52 -0
  24. package/ci/common-ci/release-config-template.json +310 -0
  25. package/ci/common-ci/release-config.json +128 -0
  26. package/ci/common-ci/release-process.drawio +165 -0
  27. package/ci/common-ci/release-process.png +0 -0
  28. package/ci/common-ci/scripts/azure/checkSlot.ps1 +28 -0
  29. package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.Tests.ps1 +1 -0
  30. package/ci/common-ci/scripts/modules/51DAuthorizationModule/51DAuthorizationModule.psm1 +16 -0
  31. package/ci/common-ci/scripts/modules/51DBuildModule/51DBuildModule.Tests.ps1 +3 -0
  32. package/ci/common-ci/scripts/modules/51DBuildModule/51DBuildModule.psm1 +200 -0
  33. package/ci/common-ci/scripts/modules/51DDeployModule/51DDeployModule.psm1 +66 -0
  34. package/ci/common-ci/scripts/modules/51DDownloadDataFileModule/51DDownloadDataFileModule.psm1 +58 -0
  35. package/ci/common-ci/scripts/modules/51DEnvironmentModule/51DEnvironmentModule.Tests.ps1 +25 -0
  36. package/ci/common-ci/scripts/modules/51DEnvironmentModule/51DEnvironmentModule.psm1 +22 -0
  37. package/ci/common-ci/scripts/modules/51DErrorHandleModule/51DErrorHandleModule.Tests.ps1 +1 -0
  38. package/ci/common-ci/scripts/modules/51DErrorHandleModule/51DErrorHandleModule.psm1 +41 -0
  39. package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.Tests.ps1 +5 -0
  40. package/ci/common-ci/scripts/modules/51DGitModule/51DGitModule.psm1 +698 -0
  41. package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.Tests.ps1 +842 -0
  42. package/ci/common-ci/scripts/modules/51DPackageModule/51DPackageModule.psm1 +926 -0
  43. package/ci/common-ci/scripts/modules/51DPipelineModule/51DPipelineModule.Tests.ps1 +1 -0
  44. package/ci/common-ci/scripts/modules/51DPipelineModule/51DPipelineModule.psm1 +87 -0
  45. package/ci/common-ci/scripts/modules/51DPullRequestModule/51DPullRequestModule.Tests.ps1 +194 -0
  46. package/ci/common-ci/scripts/modules/51DPullRequestModule/51DPullRequestModule.psm1 +653 -0
  47. package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.Tests.ps1 +277 -0
  48. package/ci/common-ci/scripts/modules/51DReleaseModule/51DReleaseModule.psm1 +554 -0
  49. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.Tests.ps1 +1141 -0
  50. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.psd1 +0 -0
  51. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/51DReleaseTestEnvModule.psm1 +1465 -0
  52. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ConfigurationVerifier.Tests.ps1 +318 -0
  53. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ConfigurationVerifier.psm1 +344 -0
  54. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.Tests.ps1 +1186 -0
  55. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/ReleaseVerifier.psm1 +900 -0
  56. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/SharedVariables.psm1 +139 -0
  57. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/c-test-env-config.json +268 -0
  58. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/dotnet-deploy-test-env-config.json +700 -0
  59. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/dotnet-test-env-config.json +533 -0
  60. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-deploy-test-env-config.json +290 -0
  61. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/go-test-env-config.json +260 -0
  62. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/java-deploy-test-env-config.json +511 -0
  63. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/java-test-env-config.json +388 -0
  64. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/node-deploy-test-env-config.json +419 -0
  65. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/node-test-env-config.json +329 -0
  66. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/php-test-env-config.json +540 -0
  67. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/python-deploy-test-env-config.json +411 -0
  68. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/python-test-env-config.json +321 -0
  69. package/ci/common-ci/scripts/modules/51DReleaseTestEnvModule/config/test-env-config.json +457 -0
  70. package/ci/common-ci/scripts/modules/51DRestModule/51DRestModule.psm1 +38 -0
  71. package/ci/common-ci/scripts/modules/AzurePortalModules/51DApplicationInsightsModule/51DApplicationInsightsModule.psm1 +104 -0
  72. package/ci/common-ci/scripts/modules/AzurePortalModules/51DChecksModule/51DChecksModule.psm1 +68 -0
  73. package/ci/common-ci/scripts/modules/AzurePortalModules/51DCloudModule/51DCloudModule.psm1 +155 -0
  74. package/ci/common-ci/scripts/modules/AzurePortalModules/51DConnectAzureModule/51DConnectAzureModule.psm1 +45 -0
  75. package/ci/common-ci/scripts/modules/AzurePortalModules/51DSSLBindingsModule/51DSSLBIndingsModule.psm1 +100 -0
  76. package/ci/common-ci/scripts/modules/AzurePortalModules/51DStagingSlotModule/51DStagingSlotModule.psm1 +50 -0
  77. package/ci/common-ci/scripts/modules/AzurePortalModules/51DStorageAccountModule/51DStorageAccountModule.psm1 +248 -0
  78. package/ci/common-ci/scripts/modules/AzurePortalModules/51DTrafficManagerModule/51DTrafficManagerModule.psm1 +58 -0
  79. package/ci/common-ci/shared-auto-complete-pr-stage.yml +61 -0
  80. package/ci/common-ci/shared-create-tag-job.yml +23 -0
  81. package/ci/common-ci/shared-docker-build-steps.yml +34 -0
  82. package/ci/common-ci/shared-docker-push-steps.yml +32 -0
  83. package/ci/common-ci/shared-docker-test-http-steps.yml +69 -0
  84. package/ci/common-ci/shared-git-tag-job.yml +38 -0
  85. package/ci/common-ci/shared-git-version-job.yml +71 -0
  86. package/ci/common-ci/shared-publish-github-stage.yml +107 -0
  87. package/ci/common-ci/shared-submodule-trigger-stage.yml +110 -0
  88. package/ci/common-ci/shared-variables.yml +3 -0
  89. package/ci/common-ci/trigger-release-apis.yml +39 -0
  90. package/ci/create-packages.yml +109 -0
  91. package/ci/deploy-external.yml +55 -0
  92. package/ci/deploy-internal.yml +50 -0
  93. package/ci/shared-build-and-test-platforms.yml +26 -0
  94. package/ci/shared-build-and-test-stage.yml +128 -0
  95. package/ci/shared-variables.yml +7 -0
  96. package/ci/submodule-trigger.yml +12 -0
  97. package/docs/Doxyfile +3 -3
  98. package/docs/DoxygenLayout.xml +1 -1
  99. package/examples/examples.test.js +3 -3
  100. package/geoLocationPipelineBuilder.js +16 -13
  101. package/package.json +14 -6
  102. package/setup.js +1 -0
  103. package/tests/geoLocationCloud.test.js +192 -0
  104. package/tsconfig.json +21 -0
  105. package/types/geoLocationCloud.d.ts +7 -0
  106. package/types/geoLocationPipelineBuilder.d.ts +17 -0
  107. package/types/index.d.ts +2 -0
  108. package/build-and-test.yml +0 -112
  109. package/publish-packages.yml +0 -87
@@ -0,0 +1,1186 @@
1
+ InModuleScope ReleaseVerifier {
2
+ Describe 'Test-Repositories' {
3
+ It 'pass all repositories verification' {
4
+ Mock New-Item {} `
5
+ -ModuleName ReleaseVerifier
6
+ Mock Pop-Location {} `
7
+ -ModuleName ReleaseVerifier
8
+ Mock Push-Location {} `
9
+ -ModuleName ReleaseVerifier
10
+ Mock Test-Path { return $true } `
11
+ -ModuleName ReleaseVerifier
12
+ Mock Test-Repository { return $true } `
13
+ -ModuleName ReleaseVerifier
14
+ $repositories = '{
15
+ "repo1": {
16
+ "version": "0.0.0"
17
+ }
18
+ }' | ConvertFrom-Json
19
+ $result = Test-Repositories `
20
+ -Repositories $repositories `
21
+ -Force `
22
+ -TeamProjectName "testproj"
23
+ $result | Should -BeExactly $true
24
+ }
25
+
26
+ It 'fail a repository verification' {
27
+ Mock New-Item {} `
28
+ -ModuleName ReleaseVerifier
29
+ Mock Pop-Location {} `
30
+ -ModuleName ReleaseVerifier
31
+ Mock Push-Location {} `
32
+ -ModuleName ReleaseVerifier
33
+ Mock Test-Path { return $true } `
34
+ -ModuleName ReleaseVerifier
35
+ Mock Test-Repository { return $false } `
36
+ -ModuleName ReleaseVerifier
37
+ $repositories = '{
38
+ "repo1": {
39
+ "version": "0.0.0"
40
+ }
41
+ }' | ConvertFrom-Json
42
+ $result = Test-Repositories `
43
+ -Repositories $repositories `
44
+ -Force `
45
+ -TeamProjectName "testproj"
46
+ $result | Should -BeExactly $false
47
+ }
48
+ }
49
+
50
+ Describe 'Test-Repository' {
51
+ It 'pass all verification' {
52
+ Mock Use-Repository { return $true } `
53
+ -ModuleName ReleaseVerifier
54
+ Mock Test-TagExist { return $true } `
55
+ -ModuleName ReleaseVerifier
56
+ Mock Get-ReleaseBranchRef { return $(New-Object -TypeName Object) } `
57
+ -ModuleName ReleaseVerifier
58
+ Mock Test-GitVersion { return $true } `
59
+ -ModuleName ReleaseVerifier
60
+ Mock Test-SubmoduleReferences { return $true } `
61
+ -ModuleName ReleaseVerifier
62
+ Mock Test-PackageDependencies { return $true } `
63
+ -ModuleName ReleaseVerifier
64
+ Mock Push-Location {} `
65
+ -ModuleName ReleaseVerifier
66
+ Mock Pop-Location {} `
67
+ -ModuleName ReleaseVerifier
68
+ $repositories = '{
69
+ "repo1": {
70
+ "version": "0.0.0"
71
+ }
72
+ }' | ConvertFrom-Json
73
+ $result = Test-Repository `
74
+ -RepositoryName "repo1" `
75
+ -RepositoryConfig $('{ "version": "test-version" }' | ConvertFrom-Json) `
76
+ -Repositories $repositories `
77
+ -TeamProjectName "testproj"
78
+ $result | Should -BeExactly $true
79
+ }
80
+
81
+ It 'fail to check out repository' {
82
+ Mock Use-Repository { return $false } `
83
+ -ModuleName ReleaseVerifier
84
+ Mock Push-Location {} `
85
+ -ModuleName ReleaseVerifier
86
+ Mock Pop-Location {} `
87
+ -ModuleName ReleaseVerifier
88
+ $repositories = '{
89
+ "repo1": {
90
+ "version": "0.0.0"
91
+ }
92
+ }' | ConvertFrom-Json
93
+ $result = Test-Repository `
94
+ -RepositoryName "repo1" `
95
+ -RepositoryConfig $(New-Object -TypeName Object) `
96
+ -Repositories $repositories `
97
+ -TeamProjectName "testproj"
98
+ $result | Should -BeExactly $false
99
+ }
100
+
101
+ It 'fail the tag verification' {
102
+ Mock Use-Repository { return $true } `
103
+ -ModuleName ReleaseVerifier
104
+ Mock Test-TagExist { return $false } `
105
+ -ModuleName ReleaseVerifier
106
+ Mock Push-Location {} `
107
+ -ModuleName ReleaseVerifier
108
+ Mock Pop-Location {} `
109
+ -ModuleName ReleaseVerifier
110
+ $repositories = '{
111
+ "repo1": {
112
+ "version": "0.0.0"
113
+ }
114
+ }' | ConvertFrom-Json
115
+ $result = Test-Repository `
116
+ -RepositoryName "repo1" `
117
+ -RepositoryConfig $('{ "version": "test-version" }' | ConvertFrom-Json) ` `
118
+ -Repositories $repositories `
119
+ -TeamProjectName "testproj"
120
+ $result | Should -BeExactly $false
121
+ }
122
+
123
+ It 'fail the GitVersion.yml verification' {
124
+ Mock Use-Repository { return $true } `
125
+ -ModuleName ReleaseVerifier
126
+ Mock Test-TagExist { return $true } `
127
+ -ModuleName ReleaseVerifier
128
+ Mock Get-ReleaseBranchRef { return $null } `
129
+ -ModuleName ReleaseVerifier
130
+ Mock Test-GitVersion { return $false } `
131
+ -ModuleName ReleaseVerifier
132
+ Mock Push-Location {} `
133
+ -ModuleName ReleaseVerifier
134
+ Mock Pop-Location {} `
135
+ -ModuleName ReleaseVerifier
136
+ $repositories = '{
137
+ "repo1": {
138
+ "version": "0.0.0"
139
+ }
140
+ }' | ConvertFrom-Json
141
+ $result = Test-Repository `
142
+ -RepositoryName "repo1" `
143
+ -RepositoryConfig $('{ "version": "test-version" }' | ConvertFrom-Json) ` `
144
+ -Repositories $repositories `
145
+ -TeamProjectName "testproj"
146
+ $result | Should -BeExactly $false
147
+ }
148
+
149
+ It 'fail the submodule references verification' {
150
+ Mock Use-Repository { return $true } `
151
+ -ModuleName ReleaseVerifier
152
+ Mock Test-TagExist { return $true } `
153
+ -ModuleName ReleaseVerifier
154
+ Mock Get-ReleaseBranchRef { return $(New-Object -TypeName Object) } `
155
+ -ModuleName ReleaseVerifier
156
+ Mock Test-GitVersion { return $true } `
157
+ -ModuleName ReleaseVerifier
158
+ Mock Test-SubmoduleReferences { return $false } `
159
+ -ModuleName ReleaseVerifier
160
+ Mock Push-Location {} `
161
+ -ModuleName ReleaseVerifier
162
+ Mock Pop-Location {} `
163
+ -ModuleName ReleaseVerifier
164
+ $repositories = '{
165
+ "repo1": {
166
+ "version": "0.0.0"
167
+ }
168
+ }' | ConvertFrom-Json
169
+ $result = Test-Repository `
170
+ -RepositoryName "repo1" `
171
+ -RepositoryConfig $('{ "version": "test-version" }' | ConvertFrom-Json) ` `
172
+ -Repositories $repositories `
173
+ -TeamProjectName "testproj"
174
+ $result | Should -BeExactly $false
175
+ }
176
+
177
+ It 'fail the package dependencies verification' {
178
+ Mock Use-Repository { return $true } `
179
+ -ModuleName ReleaseVerifier
180
+ Mock Test-TagExist { return $true } `
181
+ -ModuleName ReleaseVerifier
182
+ Mock Get-ReleaseBranchRef { return $(New-Object -TypeName Object) } `
183
+ -ModuleName ReleaseVerifier
184
+ Mock Test-GitVersion { return $true } `
185
+ -ModuleName ReleaseVerifier
186
+ Mock Test-SubmoduleReferences { return $true } `
187
+ -ModuleName ReleaseVerifier
188
+ Mock Test-PackageDependencies { return $false } `
189
+ -ModuleName ReleaseVerifier
190
+ Mock Push-Location {} `
191
+ -ModuleName ReleaseVerifier
192
+ Mock Pop-Location {} `
193
+ -ModuleName ReleaseVerifier
194
+ $repositories = '{
195
+ "repo1": {
196
+ "version": "0.0.0"
197
+ }
198
+ }' | ConvertFrom-Json
199
+ $result = Test-Repository `
200
+ -RepositoryName "repo1" `
201
+ -RepositoryConfig $('{ "version": "test-version" }' | ConvertFrom-Json) ` `
202
+ -Repositories $repositories `
203
+ -TeamProjectName "testproj"
204
+ $result | Should -BeExactly $false
205
+ }
206
+ }
207
+
208
+ Describe 'Use-Repository' {
209
+ # It 'successfully checkout a repository branch' {
210
+ # # Since it is not possible to guarantee any repo will exist
211
+ # # in the future. Use the current repository of the script to
212
+ # # test.
213
+ # $remoteUrl = git remote get-url origin
214
+ # if ($remoteUrl -match ".*/_git/(?<repo>.*$)") {
215
+ # $testRepo = $Matches['repo']
216
+ # } else {
217
+ # $false | Should -BeExactly $true -Because "# ERROR: current directory is not a git directory"
218
+ # }
219
+ #
220
+ # if([string]::IsNullOrEmpty($(git branch -r | Select-String "origin/main"))) {
221
+ # $branch = "refs/heads/master"
222
+ # } else {
223
+ # $branch = "refs/heads/main"
224
+ # }
225
+ # Mock Get-MainBranchRef { return $branch } `
226
+ # -ModuleName ReleaseVerifier
227
+ # Mock Get-RepositoryRemoteUrl { return $remoteUrl } `
228
+ # -ModuleName ReleaseVerifier
229
+ #
230
+ # $result = Use-Repository -RepositoryName $testRepo
231
+ # $result | Should -BeExactly $true
232
+ #
233
+ # # Verify if the repository is as expected
234
+ # Push-Location $testRepo
235
+ # $? | Should -BeExactly $true
236
+ #
237
+ # # Check if on main or master branch
238
+ # $isMasterMain = $(git rev-parse --abbrev-ref HEAD) -match "(master|main)"
239
+ # Pop-Location
240
+ # $? | should -BeExactly $true
241
+ #
242
+ # $isMasterMain | Should -BeExactly $true
243
+ # }
244
+
245
+ It 'fails get main branch ref' {
246
+ Mock Get-MainBranchRef { return 'nothing' } `
247
+ -ModuleName ReleaseVerifier
248
+ $result = Use-Repository -RepositoryName "testName" -TeamProjectName "testproj"
249
+ $result | Should -BeExactly $false
250
+ }
251
+
252
+ It 'fails get repository remote url' {
253
+ Mock Get-MainBranchRef { return 'refs/heads/main' } `
254
+ -ModuleName ReleaseVerifier
255
+ Mock Get-RepositoryRemoteUrl { return $null } `
256
+ -ModuleName ReleaseVerifier
257
+ $result = Use-Repository -repositoryName "testName" -TeamProjectName "testproj"
258
+ $result | Should -BeExactly $false
259
+ }
260
+ }
261
+
262
+ Describe 'Test-GitVersion' {
263
+ It 'correct git version update' {
264
+ $testVersion = "4.3.0"
265
+ Mock Test-Path { return $true } `
266
+ -ModuleName ReleaseVerifier
267
+ Mock Get-Content { return "next-version: $testVersion" } `
268
+ -ModuleName ReleaseVerifier
269
+ $configStr = @"
270
+ {
271
+ "version": "$testVersion"
272
+ }
273
+ "@
274
+ $config = $configStr | ConvertFrom-Json
275
+
276
+ $result = Test-GitVersion -RepositoryConfig $config
277
+ $result | Should -BeExactly $true
278
+ }
279
+
280
+ It 'no GitVersion.yml exists' {
281
+ Mock Test-Path { return $false } `
282
+ -ModuleName ReleaseVerifier
283
+ $result = Test-GitVersion -RepositoryConfig $(New-Object -TypeName Object)
284
+ $result | Should -BeExactly $false
285
+ }
286
+
287
+ It 'no next-version exists' {
288
+ Mock Test-Path { return $true } `
289
+ -ModuleName ReleaseVerifier
290
+ Mock Get-Content { return "nothing" } `
291
+ -ModuleName ReleaseVerifier
292
+ $configStr = @"
293
+ {
294
+ "version": "4.3.0"
295
+ }
296
+ "@
297
+ $config = $configStr | ConvertFrom-Json
298
+
299
+ $result = Test-GitVersion -RepositoryConfig $config
300
+ $result | Should -BeExactly $false
301
+ }
302
+
303
+ It 'incorrect next-version exists' {
304
+ $testVersion = "4.3.0"
305
+ Mock Test-Path { return $true } `
306
+ -ModuleName ReleaseVerifier
307
+ Mock Get-Content { return "next-version: 0.0.0" } `
308
+ -ModuleName ReleaseVerifier
309
+ $configStr = @"
310
+ {
311
+ "version": "4.3.0"
312
+ }
313
+ "@
314
+ $config = $configStr | ConvertFrom-Json
315
+
316
+ $result = Test-GitVersion -RepositoryConfig $config
317
+ $result | Should -BeExactly $false
318
+ }
319
+ }
320
+
321
+ Describe 'Test-SubmoduleReferences' {
322
+ # Alot of the steps are require git repo, submodules
323
+ # branches and tags to exists. It is also not possible
324
+ # to mock git without any unnecessary wrapping functions.
325
+ }
326
+
327
+ Describe 'Test-PackageDependencies' {
328
+ It 'all packages dependencies are up to date' {
329
+ # Java packages
330
+ $repoName = "test-java"
331
+ Mock Test-MavenPackageDependencies { return $true } `
332
+ -ModuleName ReleaseVerifier
333
+ $result = Test-PackageDependencies `
334
+ -RepositoryName $repoName `
335
+ -RepositoryConfig $(New-Object -TypeName Object) `
336
+ -Repositories $(New-Object -TypeName Object)
337
+ $result | Should -BeExactly $true
338
+
339
+ # Dotnet packages
340
+ $repoName = "test-dotnet"
341
+ Mock Test-DotnetPackageDependencies { return $true } `
342
+ -ModuleName ReleaseVerifier
343
+ $result = Test-PackageDependencies `
344
+ -RepositoryName $repoName `
345
+ -RepositoryConfig $(New-Object -TypeName Object) `
346
+ -Repositories $(New-Object -TypeName Object)
347
+ $result | Should -BeExactly $true
348
+
349
+ # Node packages
350
+ $repoName = "test-node"
351
+ Mock Test-NodePackageDependencies { return $true } `
352
+ -ModuleName ReleaseVerifier
353
+ $result = Test-PackageDependencies `
354
+ -RepositoryName $repoName `
355
+ -RepositoryConfig $(New-Object -TypeName Object) `
356
+ -Repositories $(New-Object -TypeName Object)
357
+ $result | Should -BeExactly $true
358
+
359
+ # Python packages
360
+ $repoName = "test-python"
361
+ Mock Test-PythonPackageDependencies { return $true } `
362
+ -ModuleName ReleaseVerifier
363
+ $result = Test-PackageDependencies `
364
+ -RepositoryName $repoName `
365
+ -RepositoryConfig $(New-Object -TypeName Object) `
366
+ -Repositories $(New-Object -TypeName Object)
367
+ $result | Should -BeExactly $true
368
+ }
369
+
370
+ It 'Maven packages dependencies are not up to date' {
371
+ # Java packages
372
+ $repoName = "test-java"
373
+ Mock Test-MavenPackageDependencies { return $false } `
374
+ -ModuleName ReleaseVerifier
375
+ $result = Test-PackageDependencies `
376
+ -RepositoryName $repoName `
377
+ -RepositoryConfig $(New-Object -TypeName Object) `
378
+ -Repositories $(New-Object -TypeName Object)
379
+ $result | Should -BeExactly $false
380
+ }
381
+
382
+ It 'Dotnet packages dependencies are not up to date' {
383
+ $repoName = "test-dotnet"
384
+ Mock Test-DotnetPackageDependencies { return $false } `
385
+ -ModuleName ReleaseVerifier
386
+ $result = Test-PackageDependencies `
387
+ -RepositoryName $repoName `
388
+ -RepositoryConfig $(New-Object -TypeName Object) `
389
+ -Repositories $(New-Object -TypeName Object)
390
+ $result | Should -BeExactly $false
391
+ }
392
+
393
+ It 'Node packages dependencies are not up to date' {
394
+ $repoName = "test-node"
395
+ Mock Test-NodePackageDependencies { return $false } `
396
+ -ModuleName ReleaseVerifier
397
+ $result = Test-PackageDependencies `
398
+ -RepositoryName $repoName `
399
+ -RepositoryConfig $(New-Object -TypeName Object) `
400
+ -Repositories $(New-Object -TypeName Object)
401
+ $result | Should -BeExactly $false
402
+ }
403
+
404
+ It 'Python package dependencies are not up to date' {
405
+ $repoName = "test-python"
406
+ Mock Test-PythonPackageDependencies { return $false } `
407
+ -ModuleName ReleaseVerifier
408
+ $result = Test-PackageDependencies `
409
+ -RepositoryName $repoName `
410
+ -RepositoryConfig $(New-Object -TypeName Object) `
411
+ -Repositories $(New-Object -TypeName Object)
412
+ $result | Should -BeExactly $false
413
+ }
414
+ }
415
+
416
+ Describe 'Test-MavenPackageDependencies' {
417
+ It 'all package dependencies are up to date' {
418
+ $depRepo = "dependent-java"
419
+ $repoName = "test-java"
420
+ $repoConfigStr = @"
421
+ {
422
+ "version": "4.3.0",
423
+ "packageName": "test",
424
+ "versionVariableName": "test.version",
425
+ "dependencies": [
426
+ "$depRepo"
427
+ ]
428
+ }
429
+ "@
430
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
431
+ $reposStr = @"
432
+ {
433
+ "$repoName": $repoConfigStr,
434
+ "$depRepo": {
435
+ "version": "4.3.0",
436
+ "packageName": "dep",
437
+ "versionVariableName": "dep.version"
438
+ }
439
+ }
440
+ "@
441
+ $repos = $reposStr | ConvertFrom-Json
442
+
443
+ Mock Test-Path { return $true } `
444
+ -ModuleName ReleaseVerifier
445
+ Mock Get-Content { return '<dep.version>4.3.0</dep.version>' } `
446
+ -ModuleName ReleaseVerifier
447
+
448
+ $result = Test-MavenPackageDependencies `
449
+ -RepositoryName $repoName `
450
+ -RepositoryConfig $repoConfig `
451
+ -Repositories $repos
452
+
453
+ $result | Should -BeExactly $true
454
+ }
455
+
456
+ It 'a package dependency is not up to date' {
457
+ $depRepo = "dependent-java"
458
+ $repoName = "test-java"
459
+ $repoConfigStr = @"
460
+ {
461
+ "version": "4.3.0",
462
+ "packageName": "test",
463
+ "versionVariableName": "test.version",
464
+ "dependencies": [
465
+ "$depRepo"
466
+ ]
467
+ }
468
+ "@
469
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
470
+ $reposStr = @"
471
+ {
472
+ "$repoName": $repoConfigStr,
473
+ "$depRepo": {
474
+ "version": "4.3.0",
475
+ "packageName": "dep",
476
+ "versionVariableName": "dep.version"
477
+ }
478
+ }
479
+ "@
480
+ $repos = $reposStr | ConvertFrom-Json
481
+
482
+ Mock Test-Path { return $true } `
483
+ -ModuleName ReleaseVerifier
484
+ Mock Get-Content { return '<dep.version>4.2.9</dep.version>' } `
485
+ -ModuleName ReleaseVerifier
486
+
487
+ $result = Test-MavenPackageDependencies `
488
+ -RepositoryName $repoName `
489
+ -RepositoryConfig $repoConfig `
490
+ -Repositories $repos
491
+
492
+ $result | Should -BeExactly $false
493
+ }
494
+ }
495
+
496
+ Describe 'Test-DotnetPackageDependencies' {
497
+ BeforeAll {
498
+ function Test-DotnetPackageDependenciesOnelineBase {
499
+ param (
500
+ [string]$ExpectedVersion,
501
+ [string]$ActualVersion,
502
+ [string]$ConfigDepPackageName,
503
+ [string]$ActualDepPackageName,
504
+ [boolean]$ExpectedResult
505
+ )
506
+ $depRepo = "dependent-dotnet"
507
+ $repoName = "test-dotnet"
508
+ $repoConfigStr = @"
509
+ {
510
+ "version": "4.3.0",
511
+ "packageName": "test.dotnet",
512
+ "dependencies": [
513
+ "$depRepo"
514
+ ]
515
+ }
516
+ "@
517
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
518
+ $reposStr = @"
519
+ {
520
+ "$repoName": $repoConfigStr,
521
+ "$depRepo": {
522
+ "version": "$ExpectedVersion",
523
+ "packageName": "$ConfigDepPackageName"
524
+ }
525
+ }
526
+ "@
527
+ $repos = $reposStr | ConvertFrom-Json
528
+
529
+ Mock Test-Path { return $true } `
530
+ -ModuleName ReleaseVerifier
531
+ Mock Get-ChildItem { return @($('{ "FullName": "file1.csproj" }' | ConvertFrom-Json)) } `
532
+ -ModuleName ReleaseVerifier
533
+ Mock Get-Content { return "<PackageReference Include=`"$ActualDepPackageName)`" Version=`"$ActualVersion`" />" } `
534
+ -ModuleName ReleaseVerifier
535
+
536
+ $result = Test-DotnetPackageDependencies `
537
+ -RepositoryName $repoName `
538
+ -RepositoryConfig $repoConfig `
539
+ -Repositories $repos
540
+
541
+ $result | Should -BeExactly $ExpectedResult
542
+ }
543
+
544
+ function Test-DotnetPackageDependenciesOneline {
545
+ param (
546
+ [string]$ExpectedVersion,
547
+ [string]$ActualVersion,
548
+ [boolean]$ExpectedResult
549
+ )
550
+ Test-DotnetPackageDependenciesOnelineBase `
551
+ -ExpectedVersion $ExpectedVersion `
552
+ -ActualVersion $ActualVersion `
553
+ -ConfigDepPackageName "dep.dotnet" `
554
+ -ActualDepPackageName "dep.dotnet" `
555
+ -ExpectedResult $ExpectedResult
556
+ }
557
+
558
+ function Test-DotnetPackageDependenciesOnelineRegex {
559
+ param (
560
+ [string]$ExpectedVersion,
561
+ [string]$ActualVersion,
562
+ [boolean]$ExpectedResult
563
+ )
564
+ Test-DotnetPackageDependenciesOnelineBase `
565
+ -ExpectedVersion $ExpectedVersion `
566
+ -ActualVersion $ActualVersion `
567
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
568
+ -ActualDepPackageName "dep.dotnet" `
569
+ -ExpectedResult $ExpectedResult
570
+ }
571
+
572
+ function Test-DotnetPackageDependenciesMultilinesBase {
573
+ param (
574
+ [string]$ExpectedVersion,
575
+ [string]$ActualVersion,
576
+ [string]$ConfigDepPackageName,
577
+ [string]$ActualDepPackageName,
578
+ [boolean]$ExpectedResult
579
+ )
580
+ $depRepo = "dependent-dotnet"
581
+ $repoName = "test-dotnet"
582
+ $repoConfigStr = @"
583
+ {
584
+ "version": "4.3.0",
585
+ "packageName": "test.dotnet",
586
+ "dependencies": [
587
+ "$depRepo"
588
+ ]
589
+ }
590
+ "@
591
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
592
+ $reposStr = @"
593
+ {
594
+ "$repoName": $repoConfigStr,
595
+ "$depRepo": {
596
+ "version": "$ExpectedVersion",
597
+ "packageName": "$ConfigDepPackageName"
598
+ }
599
+ }
600
+ "@
601
+ $repos = $reposStr | ConvertFrom-Json
602
+
603
+ Mock Test-Path { return $true } `
604
+ -ModuleName ReleaseVerifier
605
+ Mock Get-ChildItem { return @($('{ "FullName": "file1.csproj" }' | ConvertFrom-Json)) } `
606
+ -ModuleName ReleaseVerifier
607
+ Mock Get-Content { return "<PackageReference Include=`"$ActualDepPackageName`">`r`n<Version>$ActualVersion</Version>`r`n</PackageReference>" } `
608
+ -ModuleName ReleaseVerifier
609
+
610
+ $result = Test-DotnetPackageDependencies `
611
+ -RepositoryName $repoName `
612
+ -RepositoryConfig $repoConfig `
613
+ -Repositories $repos
614
+
615
+ $result | Should -BeExactly $ExpectedResult
616
+ }
617
+
618
+ function Test-DotnetPackageDependenciesMultilines {
619
+ param (
620
+ [string]$ExpectedVersion,
621
+ [string]$ActualVersion,
622
+ [boolean]$ExpectedResult
623
+ )
624
+ Test-DotnetPackageDependenciesMultilinesBase `
625
+ -ExpectedVersion $ExpectedVersion `
626
+ -ActualVersion $ActualVersion `
627
+ -ConfigDepPackageName "dep.dotnet" `
628
+ -ActualDepPackageName "dep.dotnet" `
629
+ -ExpectedResult $ExpectedResult
630
+ }
631
+
632
+ function Test-DotnetPackageDependenciesMultilinesRegex {
633
+ param (
634
+ [string]$ExpectedVersion,
635
+ [string]$ActualVersion,
636
+ [boolean]$ExpectedResult
637
+ )
638
+ Test-DotnetPackageDependenciesMultilinesBase `
639
+ -ExpectedVersion $ExpectedVersion `
640
+ -ActualVersion $ActualVersion `
641
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
642
+ -ActualDepPackageName "dep.dotnet" `
643
+ -ExpectedResult $ExpectedResult
644
+ }
645
+
646
+ function Test-DotnetPackageDependenciesNetFrameworkProjectBase {
647
+ param (
648
+ [string]$ExpectedVersion,
649
+ [string]$ActualVersion,
650
+ [string]$ConfigDepPackageName,
651
+ [string]$ActualDepPackageName,
652
+ [boolean]$ExpectedResult
653
+ )
654
+ $depRepo = "dependent-dotnet"
655
+ $repoName = "test-dotnet"
656
+ $repoConfigStr = @"
657
+ {
658
+ "version": "4.3.0",
659
+ "packageName": "test.dotnet",
660
+ "dependencies": [
661
+ "$depRepo"
662
+ ]
663
+ }
664
+ "@
665
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
666
+ $reposStr = @"
667
+ {
668
+ "$repoName": $repoConfigStr,
669
+ "$depRepo": {
670
+ "version": "$ExpectedVersion",
671
+ "packageName": "$ConfigDepPackageName"
672
+ }
673
+ }
674
+ "@
675
+ $repos = $reposStr | ConvertFrom-Json
676
+
677
+ Mock Test-Path { return $true } `
678
+ -ModuleName ReleaseVerifier
679
+ Mock Get-ChildItem { return @($('{ "FullName": "file1.csproj" }' | ConvertFrom-Json)) } `
680
+ -ModuleName ReleaseVerifier
681
+ Mock Get-Content { return "<HintPath>..\..\..\..\..\packages\$($ActualDepPackageName).test.$($ActualVersion)\lib\netstandard2.0\dep.dotnet.test.dll</HintPath>" } `
682
+ -ModuleName ReleaseVerifier
683
+
684
+ $result = Test-DotnetPackageDependencies `
685
+ -RepositoryName $repoName `
686
+ -RepositoryConfig $repoConfig `
687
+ -Repositories $repos
688
+
689
+ $result | Should -BeExactly $ExpectedResult
690
+ }
691
+
692
+ function Test-DotnetPackageDependenciesNetFrameworkProject {
693
+ param (
694
+ [string]$ExpectedVersion,
695
+ [string]$ActualVersion,
696
+ [boolean]$ExpectedResult
697
+ )
698
+ Test-DotnetPackageDependenciesNetFrameworkProjectBase `
699
+ -ExpectedVersion $ExpectedVersion `
700
+ -ActualVersion $ActualVersion `
701
+ -ConfigDepPackageName "dep.dotnet" `
702
+ -ActualDepPackageName "dep.dotnet" `
703
+ -ExpectedResult $ExpectedResult
704
+ }
705
+
706
+ function Test-DotnetPackageDependenciesNetFrameworkProjectRegex {
707
+ param (
708
+ [string]$ExpectedVersion,
709
+ [string]$ActualVersion,
710
+ [boolean]$ExpectedResult
711
+ )
712
+ Test-DotnetPackageDependenciesNetFrameworkProjectBase `
713
+ -ExpectedVersion $ExpectedVersion `
714
+ -ActualVersion $ActualVersion `
715
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
716
+ -ActualDepPackageName "dep.dotnet" `
717
+ -ExpectedResult $ExpectedResult
718
+ }
719
+
720
+ function Test-DotnetPackageDependenciesPackagesConfigBase {
721
+ param (
722
+ [string]$ExpectedVersion,
723
+ [string]$ActualVersion,
724
+ [string]$ConfigDepPackageName,
725
+ [string]$ActualDepPackageName,
726
+ [boolean]$ExpectedResult
727
+ )
728
+ $depRepo = "dependent-dotnet"
729
+ $repoName = "test-dotnet"
730
+ $repoConfigStr = @"
731
+ {
732
+ "version": "4.3.0",
733
+ "packageName": "test.dotnet",
734
+ "dependencies": [
735
+ "$depRepo"
736
+ ]
737
+ }
738
+ "@
739
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
740
+ $reposStr = @"
741
+ {
742
+ "$repoName": $repoConfigStr,
743
+ "$depRepo": {
744
+ "version": "$ExpectedVersion",
745
+ "packageName": "$ConfigDepPackageName"
746
+ }
747
+ }
748
+ "@
749
+ $repos = $reposStr | ConvertFrom-Json
750
+
751
+ Mock Test-Path { return $true } `
752
+ -ModuleName ReleaseVerifier
753
+ Mock Get-ChildItem { return @($('{ "FullName": "packages.config" }' | ConvertFrom-Json)) } `
754
+ -ModuleName ReleaseVerifier
755
+ Mock Get-Content { return "<package id=`"$($ActualDepPackageName).test`" version=`"$ActualVersion`" targetFramework=`"net472`" />" } `
756
+ -ModuleName ReleaseVerifier
757
+
758
+ $result = Test-DotnetPackageDependencies `
759
+ -RepositoryName $repoName `
760
+ -RepositoryConfig $repoConfig `
761
+ -Repositories $repos
762
+
763
+ $result | Should -BeExactly $ExpectedResult
764
+ }
765
+
766
+ function Test-DotnetPackageDependenciesPackagesConfig {
767
+ param (
768
+ [string]$ExpectedVersion,
769
+ [string]$ActualVersion,
770
+ [boolean]$ExpectedResult
771
+ )
772
+ Test-DotnetPackageDependenciesPackagesConfigBase `
773
+ -ExpectedVersion $ExpectedVersion `
774
+ -ActualVersion $ActualVersion `
775
+ -ConfigDepPackageName "dep.dotnet" `
776
+ -ActualDepPackageName "dep.dotnet" `
777
+ -ExpectedResult $ExpectedResult
778
+ }
779
+
780
+ function Test-DotnetPackageDependenciesPackagesConfigRegex {
781
+ param (
782
+ [string]$ExpectedVersion,
783
+ [string]$ActualVersion,
784
+ [boolean]$ExpectedResult
785
+ )
786
+ Test-DotnetPackageDependenciesPackagesConfigBase `
787
+ -ExpectedVersion $ExpectedVersion `
788
+ -ActualVersion $ActualVersion `
789
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
790
+ -ActualDepPackageName "dep.dotnet" `
791
+ -ExpectedResult $ExpectedResult
792
+ }
793
+ }
794
+
795
+ It 'all package dependencies are up to date with syntax `<PackageReference `/`>' {
796
+ Test-DotnetPackageDependenciesOneline -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
797
+ }
798
+
799
+ It 'all package dependencies are up to date with syntax `<PackageReference `/`> with regex' {
800
+ Test-DotnetPackageDependenciesOnelineRegex -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
801
+ }
802
+
803
+ It 'a package dependency is not up to date with syntax `<PackageReference `/`>' {
804
+ Test-DotnetPackageDependenciesOneline -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
805
+ }
806
+
807
+ It 'a package dependency is not up to date with syntax `<PackageReference `/`> with regex' {
808
+ Test-DotnetPackageDependenciesOnelineRegex -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
809
+ }
810
+
811
+ It 'all package dependencies are up to date with syntax `<PackageReference`>`<`/PackageReference`>' {
812
+ Test-DotnetPackageDependenciesMultilines -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
813
+ }
814
+
815
+ It 'all package dependencies are up to date with syntax `<PackageReference`>`<`/PackageReference`> with regex' {
816
+ Test-DotnetPackageDependenciesMultilinesRegex -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
817
+ }
818
+
819
+ It 'a package dependency is not up to date with syntax `<PackageReference`>`<`/PackageReference`>' {
820
+ Test-DotnetPackageDependenciesMultilines -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
821
+ }
822
+
823
+ It 'a package dependency is not up to date with syntax `<PackageReference`>`<`/PackageReference`> with regex' {
824
+ Test-DotnetPackageDependenciesMultilinesRegex -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
825
+ }
826
+
827
+ It 'all package dependencies are up to date with dotnet framework .csproj syntax' {
828
+ Test-DotnetPackageDependenciesNetFrameworkProject -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
829
+ }
830
+
831
+ It 'all package dependencies are up to date with dotnet framework .csproj syntax with regex' {
832
+ Test-DotnetPackageDependenciesNetFrameworkProjectRegex -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
833
+ }
834
+
835
+ It 'a package dependency is not up to date with dotnet framework .csproj syntax' {
836
+ Test-DotnetPackageDependenciesNetFrameworkProject -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
837
+ }
838
+
839
+ It 'a package dependency is not up to date with dotnet framework .csproj syntax with regex' {
840
+ Test-DotnetPackageDependenciesNetFrameworkProjectRegex -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
841
+ }
842
+
843
+ It 'all package dependencies are up to date with packages.config file' {
844
+ Test-DotnetPackageDependenciesPackagesConfig -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
845
+ }
846
+
847
+ It 'all package dependencies are up to date with packages.config file with regex' {
848
+ Test-DotnetPackageDependenciesPackagesConfigRegex -ExpectedVersion "4.3.0" -ActualVersion "4.3.0" -ExpectedResult $true
849
+ }
850
+
851
+ It 'a package dependency is not up to date with packages.config file' {
852
+ Test-DotnetPackageDependenciesPackagesConfig -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
853
+ }
854
+
855
+ It 'a package dependency is not up to date with packages.config file with regex' {
856
+ Test-DotnetPackageDependenciesPackagesConfigRegex -ExpectedVersion "4.3.0" -ActualVersion "4.2.9" -ExpectedResult $false
857
+ }
858
+ }
859
+
860
+ Describe 'Test-NodePackageDependencies' {
861
+ It 'all package dependencies are up to date' {
862
+ $depRepo = "dependent-node"
863
+ $repoName = "test-node"
864
+ $repoConfigStr = @"
865
+ {
866
+ "version": "4.3.0",
867
+ "packageName": "test.node",
868
+ "dependencies": [
869
+ "$depRepo"
870
+ ]
871
+ }
872
+ "@
873
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
874
+ $reposStr = @"
875
+ {
876
+ "$repoName": $repoConfigStr,
877
+ "$depRepo": {
878
+ "version": "4.3.0",
879
+ "packageName": "dep.node"
880
+ }
881
+ }
882
+ "@
883
+ $repos = $reposStr | ConvertFrom-Json
884
+ Mock Test-NodeDependenciesSub { return $true } `
885
+ -ModuleName ReleaseVerifier
886
+
887
+ $result = Test-NodePackageDependencies `
888
+ -RepositoryName $repoName `
889
+ -RepositoryConfig $repoConfig `
890
+ -Repositories $repos
891
+
892
+ $result | Should -BeExactly $true
893
+ }
894
+
895
+ It 'a package dependency is not up to date' {
896
+ $depRepo = "dependent-node"
897
+ $repoName = "test-node"
898
+ $repoConfigStr = @"
899
+ {
900
+ "version": "4.3.0",
901
+ "packageName": "test.node",
902
+ "dependencies": [
903
+ "$depRepo"
904
+ ]
905
+ }
906
+ "@
907
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
908
+ $reposStr = @"
909
+ {
910
+ "$repoName": $repoConfigStr,
911
+ "$depRepo": {
912
+ "version": "4.3.0",
913
+ "packageName": "dep.node"
914
+ }
915
+ }
916
+ "@
917
+ $repos = $reposStr | ConvertFrom-Json
918
+ Mock Test-NodeDependenciesSub { return $false } `
919
+ -ModuleName ReleaseVerifier
920
+
921
+ $result = Test-NodePackageDependencies `
922
+ -RepositoryName $repoName `
923
+ -RepositoryConfig $repoConfig `
924
+ -Repositories $repos
925
+
926
+ $result | Should -BeExactly $false
927
+ }
928
+ }
929
+
930
+ Describe 'Test-NodeDependenciesSub' {
931
+ It 'All packages dependencies are up to date' {
932
+ $depRepo = "dependent-node"
933
+ $repoName = "test-node"
934
+ $repoConfigStr = @"
935
+ {
936
+ "version": "4.3.0",
937
+ "packageName": "test.node",
938
+ "dependencies": [
939
+ "$depRepo"
940
+ ]
941
+ }
942
+ "@
943
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
944
+ $reposStr = @"
945
+ {
946
+ "$repoName": $repoConfigStr,
947
+ "$depRepo": {
948
+ "version": "4.3.0",
949
+ "packageName": "dep.node"
950
+ }
951
+ }
952
+ "@
953
+ $repos = $reposStr | ConvertFrom-Json
954
+ Mock Get-ChildItem { return $('{ "FullName" : "package.json" }' | ConvertFrom-Json) } `
955
+ -ModuleName ReleaseVerifier
956
+ Mock Get-Content { return "something" } `
957
+ -ModuleName ReleaseVerifier
958
+ Mock Test-NodePackageDependency { return $true } `
959
+ -ModuleName ReleaseVerifier
960
+
961
+ $result = Test-NodeDependenciesSub `
962
+ -RepositoryName $repoName `
963
+ -Repositories $repos `
964
+ -PackageFileName 'package.json'
965
+
966
+ $result | Should -BeExactly $true
967
+ }
968
+
969
+ It 'A package dependency in package.json is not up to date' {
970
+ $depRepo = "dependent-node"
971
+ $repoName = "test-node"
972
+ $repoConfigStr = @"
973
+ {
974
+ "version": "4.3.0",
975
+ "packageName": "test.node",
976
+ "dependencies": [
977
+ "$depRepo"
978
+ ]
979
+ }
980
+ "@
981
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
982
+ $reposStr = @"
983
+ {
984
+ "$repoName": $repoConfigStr,
985
+ "$depRepo": {
986
+ "version": "4.3.0",
987
+ "packageName": "dep.node"
988
+ }
989
+ }
990
+ "@
991
+ $repos = $reposStr | ConvertFrom-Json
992
+ Mock Get-ChildItem { return $('{ "FullName" : "package.json" }' | ConvertFrom-Json) } `
993
+ -ModuleName ReleaseVerifier
994
+ Mock Get-Content { return "something" } `
995
+ -ModuleName ReleaseVerifier
996
+ Mock Test-NodePackageDependency { return $false } `
997
+ -ModuleName ReleaseVerifier
998
+
999
+ $result = Test-NodeDependenciesSub `
1000
+ -RepositoryName $repoName `
1001
+ -Repositories $repos `
1002
+ -PackageFileName 'package.json'
1003
+
1004
+ $result | Should -BeExactly $false
1005
+ }
1006
+
1007
+ It 'A package dependency in remote_package.json is not up to date' {
1008
+ $depRepo = "dependent-node"
1009
+ $repoName = "test-node"
1010
+ $repoConfigStr = @"
1011
+ {
1012
+ "version": "4.3.0",
1013
+ "packageName": "test.node"
1014
+ }
1015
+ "@
1016
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
1017
+ $reposStr = @"
1018
+ {
1019
+ "$repoName": $repoConfigStr,
1020
+ "$depRepo": {
1021
+ "version": "4.3.0",
1022
+ "packageName": "dep.node"
1023
+ }
1024
+ }
1025
+ "@
1026
+ $repos = $reposStr | ConvertFrom-Json
1027
+ Mock Get-ChildItem { return $('{ "FullName" : "remote_package.json" }' | ConvertFrom-Json) } `
1028
+ -ModuleName ReleaseVerifier
1029
+ Mock Get-Content { return "something" } `
1030
+ -ModuleName ReleaseVerifier
1031
+ Mock Test-NodePackageDependency { return $false } `
1032
+ -ModuleName ReleaseVerifier
1033
+
1034
+ $result = Test-NodeDependenciesSub `
1035
+ -RepositoryName $repoName `
1036
+ -Repositories $repos `
1037
+ -PackageFileName 'remote_package.json'
1038
+
1039
+ $result | Should -BeExactly $false
1040
+ }
1041
+ }
1042
+
1043
+ Describe 'Test-NodePackageDependency' {
1044
+ It 'All packages dependencies are up to date' {
1045
+ $depRepo = "dependent-node"
1046
+ $repoName = "test-node"
1047
+ $repoConfigStr = @"
1048
+ {
1049
+ "version": "4.3.0",
1050
+ "packageName": "test.node"
1051
+ }
1052
+ "@
1053
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
1054
+ $reposStr = @"
1055
+ {
1056
+ "$repoName": $repoConfigStr,
1057
+ "$depRepo": {
1058
+ "version": "4.3.0",
1059
+ "packageName": "dep.node"
1060
+ }
1061
+ }
1062
+ "@
1063
+ $repos = $reposStr | ConvertFrom-Json
1064
+ $packageFileContent = '"dep.node.test" : "^4.3.0"'
1065
+
1066
+ $result = Test-NodePackageDependency `
1067
+ -RepositoryName $depRepo `
1068
+ -Repositories $repos `
1069
+ -PackageFileContent $packageFileContent `
1070
+ -IsRemotePackage $false
1071
+
1072
+ $result | Should -BeExactly $true
1073
+ }
1074
+
1075
+ It 'A package dependency is not up to date' {
1076
+ $depRepo = "dependent-node"
1077
+ $repoName = "test-node"
1078
+ $repoConfigStr = @"
1079
+ {
1080
+ "version": "4.3.0",
1081
+ "packageName": "test.node"
1082
+ }
1083
+ "@
1084
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
1085
+ $reposStr = @"
1086
+ {
1087
+ "$repoName": $repoConfigStr,
1088
+ "$depRepo": {
1089
+ "version": "4.3.0",
1090
+ "packageName": "dep.node"
1091
+ }
1092
+ }
1093
+ "@
1094
+ $repos = $reposStr | ConvertFrom-Json
1095
+ $packageFileContent = '"dep.node.test" : "^4.2.9"'
1096
+
1097
+ $result = Test-NodePackageDependency `
1098
+ -RepositoryName $depRepo `
1099
+ -Repositories $repos `
1100
+ -PackageFileContent $packageFileContent `
1101
+ -IsRemotePackage $false
1102
+
1103
+ $result | Should -BeExactly $false
1104
+ }
1105
+ }
1106
+
1107
+ Describe 'Test-PythonPackageDependencies' {
1108
+ It 'all package dependencies are up to date' {
1109
+ $depRepo = "dependent-python"
1110
+ $repoName = "test-python"
1111
+ $repoConfigStr = @"
1112
+ {
1113
+ "version": "4.3.0",
1114
+ "packageName": "test",
1115
+ "versionVariableName": "testVersion",
1116
+ "dependencies": [
1117
+ "$depRepo"
1118
+ ]
1119
+ }
1120
+ "@
1121
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
1122
+ $reposStr = @"
1123
+ {
1124
+ "$repoName": $repoConfigStr,
1125
+ "$depRepo": {
1126
+ "version": "4.3.0",
1127
+ "packageName": "dep",
1128
+ "versionVariableName": "depVersion"
1129
+ }
1130
+ }
1131
+ "@
1132
+ $repos = $reposStr | ConvertFrom-Json
1133
+
1134
+ Mock Test-Path { return $true } `
1135
+ -ModuleName ReleaseVerifier
1136
+ Mock Get-Content { return "name: depVersion`r`nvalue: '==4.3.0'" } `
1137
+ -ModuleName ReleaseVerifier
1138
+
1139
+ $result = Test-PythonPackageDependencies `
1140
+ -RepositoryName $repoName `
1141
+ -RepositoryConfig $repoConfig `
1142
+ -Repositories $repos
1143
+
1144
+ $result | Should -BeExactly $true
1145
+ }
1146
+
1147
+ It 'a package dependency is not up to date' {
1148
+ $depRepo = "dependent-python"
1149
+ $repoName = "test-python"
1150
+ $repoConfigStr = @"
1151
+ {
1152
+ "version": "4.3.0",
1153
+ "packageName": "test",
1154
+ "versionVariableName": "testVersion",
1155
+ "dependencies": [
1156
+ "$depRepo"
1157
+ ]
1158
+ }
1159
+ "@
1160
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
1161
+ $reposStr = @"
1162
+ {
1163
+ "$repoName": $repoConfigStr,
1164
+ "$depRepo": {
1165
+ "version": "4.3.0",
1166
+ "packageName": "dep",
1167
+ "versionVariableName": "depVersion"
1168
+ }
1169
+ }
1170
+ "@
1171
+ $repos = $reposStr | ConvertFrom-Json
1172
+
1173
+ Mock Test-Path { return $true } `
1174
+ -ModuleName ReleaseVerifier
1175
+ Mock Get-Content { return "name: depVersion`r`nvalue: '==4.2.9'" } `
1176
+ -ModuleName ReleaseVerifier
1177
+
1178
+ $result = Test-PythonPackageDependencies `
1179
+ -RepositoryName $repoName `
1180
+ -RepositoryConfig $repoConfig `
1181
+ -Repositories $repos
1182
+
1183
+ $result | Should -BeExactly $false
1184
+ }
1185
+ }
1186
+ }