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,842 @@
1
+ Describe 'Update-PackageDependencies' {
2
+ It 'successfully update all package version java' {
3
+ Mock Initialize-GlobalVariables { } `
4
+ -ModuleName 51DPackageModule
5
+ Mock Get-RepositoryName { return 'test-java' } `
6
+ -ModuleName 51DPackageModule
7
+ Mock Update-MavenPackageDependencies { return $true } `
8
+ -ModuleName 51DPackageModule
9
+ $result = Update-PackageDependencies `
10
+ -Configuration $(New-Object -TypeName Object) `
11
+ -TeamProjectName "testproj"
12
+ $result | Should -BeExactly $true
13
+ }
14
+
15
+ It 'successfully update all package version dotnet' {
16
+ Mock Initialize-GlobalVariables { } `
17
+ -ModuleName 51DPackageModule
18
+ Mock Get-RepositoryName { return 'test-dotnet' } `
19
+ -ModuleName 51DPackageModule
20
+ Mock Update-DotnetPackageDependencies { return $true } `
21
+ -ModuleName 51DPackageModule
22
+ $result = Update-PackageDependencies `
23
+ -Configuration $(New-Object -TypeName Object) `
24
+ -TeamProjectName "testproj"
25
+ $result | Should -BeExactly $true
26
+ }
27
+
28
+ It 'successfully update all package version node' {
29
+ Mock Initialize-GlobalVariables { } `
30
+ -ModuleName 51DPackageModule
31
+ Mock Get-RepositoryName { return 'test-node' } `
32
+ -ModuleName 51DPackageModule
33
+ Mock Update-NodePackageDependencies { return $true } `
34
+ -ModuleName 51DPackageModule
35
+ $result = Update-PackageDependencies `
36
+ -Configuration $(New-Object -TypeName Object) `
37
+ -TeamProjectName "testproj"
38
+ $result | Should -BeExactly $true
39
+ }
40
+
41
+ It 'successfully update all package version python' {
42
+ Mock Initialize-GlobalVariables { } `
43
+ -ModuleName 51DPackageModule
44
+ Mock Get-RepositoryName { return 'test-python' } `
45
+ -ModuleName 51DPackageModule
46
+ Mock Update-PythonPackageDependencies { return $true } `
47
+ -ModuleName 51DPackageModule
48
+ $result = Update-PackageDependencies `
49
+ -Configuration $(New-Object -TypeName Object) `
50
+ -TeamProjectName "testproj"
51
+ $result | Should -BeExactly $true
52
+ }
53
+
54
+ It 'successfully update all package version go' {
55
+ Mock Initialize-GlobalVariables { } `
56
+ -ModuleName 51DPackageModule
57
+ Mock Get-RepositoryName { return 'test-go' } `
58
+ -ModuleName 51DPackageModule
59
+ Mock Update-GoPackageDependencies { return $true } `
60
+ -ModuleName 51DPackageModule
61
+ $result = Update-PackageDependencies `
62
+ -Configuration $(New-Object -TypeName Object) `
63
+ -TeamProjectName "testproj"
64
+ $result | Should -BeExactly $true
65
+ }
66
+
67
+ It 'package does not need to be updated' {
68
+ Mock Initialize-GlobalVariables { } `
69
+ -ModuleName 51DPackageModule
70
+ Mock Get-RepositoryName { return 'test-php-core' } `
71
+ -ModuleName 51DPackageModule
72
+ $result = Update-PackageDependencies `
73
+ -Configuration $(New-Object -TypeName Object) `
74
+ -TeamProjectName "testproj"
75
+ $result | Should -BeExactly $true
76
+ }
77
+ }
78
+
79
+ InModuleScope 51DPackageModule {
80
+ Describe 'Update-GoPackageContent' {
81
+ BeforeAll {
82
+ function Test-GoSuccessfulVersionUpdate {
83
+ param (
84
+ [string]$SourceVersion
85
+ )
86
+
87
+ $depRepo = "dependent-go"
88
+ $repoName = "test-go"
89
+ $repoConfigStr = @"
90
+ {
91
+ "version": "4.3.0",
92
+ "dependencies": [
93
+ "$depRepo"
94
+ ]
95
+ }
96
+ "@
97
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
98
+ $reposStr = @"
99
+ {
100
+ "$repoName": $repoConfigStr,
101
+ "$depRepo": {
102
+ "version": "4.3.0"
103
+ }
104
+ }
105
+ "@
106
+ $repos = $reposStr | ConvertFrom-Json
107
+
108
+ $configStr = @"
109
+ {
110
+ "repositories": $reposStr
111
+ }
112
+ "@
113
+ $config = $configStr | ConvertFrom-Json
114
+
115
+ # Initialize script scope variable
116
+ Initialize-GlobalVariables -Configuration $config
117
+
118
+ Mock Test-TagExist { return $true } `
119
+ -ModuleName 51DPackageModule
120
+ $content = "require github.com/51Degrees/dependent-go v$SourceVersion"
121
+ $contentWithComment = "require github.com/51Degrees/dependent-go v$SourceVersion // indirect"
122
+ $contentWithReplace = "require github.com/51Degrees/dependent-go v$SourceVersion`r`n" +
123
+ "replace github.com/51Degrees/dependent-go v$SourceVersion => ./local"
124
+
125
+ Write-Host $content
126
+ Write-Host $repoConfig.dependencies
127
+ # Test default content
128
+ $updatedContent = Update-GoPackageContent `
129
+ -Dependencies $repoConfig.dependencies `
130
+ -GoModContent $content `
131
+ -TeamProjectName "TestProject"
132
+ $updatedContent | Should -BeExactly "require github.com/51Degrees/dependent-go v4.3.0"
133
+
134
+ # Test content with comment
135
+ $updatedContentWithComment = Update-GoPackageContent `
136
+ -Dependencies $repoConfig.dependencies `
137
+ -GoModContent $contentWithComment `
138
+ -TeamProjectName "TestProject"
139
+ $updatedContentWithComment | Should -BeExactly "require github.com/51Degrees/dependent-go v4.3.0 // indirect"
140
+
141
+ # Test content with replace
142
+ $expected = "require github.com/51Degrees/dependent-go v4.3.0`r`n" +
143
+ "replace github.com/51Degrees/dependent-go v4.3.0 => ./local"
144
+ $updatedContentWithReplace = Update-GoPackageContent `
145
+ -Dependencies $repoConfig.dependencies `
146
+ -GoModContent $contentWithReplace `
147
+ -TeamProjectName "TestProject"
148
+ $updatedContentWithReplace | Should -BeExactly $expected
149
+ }
150
+ }
151
+
152
+ It 'successfully update the content with well formed version' {
153
+ Test-GoSuccessfulVersionUpdate -SourceVersion "0.0.0"
154
+ }
155
+
156
+ It 'successfully update the content with non release well formed version' {
157
+ Test-GoSuccessfulVersionUpdate -SourceVersion "0.0.0-beta.18+1"
158
+ }
159
+ }
160
+ }
161
+
162
+ InModuleScope 51DPackageModule {
163
+ Describe 'Update-PythonPackageContent' {
164
+ BeforeAll {
165
+ function Test-PythonSuccessfulVersionUpdate {
166
+ param (
167
+ [string]$SourceVersion
168
+ )
169
+
170
+ $depRepo = "dependent-python"
171
+ $repoName = "test-python"
172
+ $repoConfigStr = @"
173
+ {
174
+ "version": "4.3.0",
175
+ "packageName": "test",
176
+ "versionVariableName": "testVersion",
177
+ "dependencies": [
178
+ "$depRepo"
179
+ ]
180
+ }
181
+ "@
182
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
183
+ $reposStr = @"
184
+ {
185
+ "$repoName": $repoConfigStr,
186
+ "$depRepo": {
187
+ "version": "4.3.0",
188
+ "packageName": "dep",
189
+ "versionVariableName": "depVersion"
190
+ }
191
+ }
192
+ "@
193
+ $repos = $reposStr | ConvertFrom-Json
194
+
195
+ $configStr = @"
196
+ {
197
+ "repositories": $reposStr
198
+ }
199
+ "@
200
+ $config = $configStr | ConvertFrom-Json
201
+
202
+ # Initialize script scope variable
203
+ Initialize-GlobalVariables -Configuration $config
204
+
205
+ Mock Test-TagExist { return $true } `
206
+ -ModuleName 51DPackageModule
207
+ $content = "name: depVersion`r`nvalue: '==$SourceVersion'"
208
+ $updatedContent = Update-PythonPackageContent `
209
+ -Dependencies $repoConfig.dependencies `
210
+ -SharedVariableContent $content `
211
+ -TeamProjectName "TestProject"
212
+ $updatedContent | Should -BeExactly "name: depVersion`r`nvalue: '==4.3.0'"
213
+ }
214
+ }
215
+
216
+ It 'successfully update the content with well formed version' {
217
+ Test-PythonSuccessfulVersionUpdate -SourceVersion "0.0.0"
218
+ }
219
+
220
+ It 'successfully update the content with non release well formed version' {
221
+ Test-PythonSuccessfulVersionUpdate -SourceVersion "0.0.0-beta.18+1"
222
+ }
223
+ }
224
+ }
225
+
226
+ InModuleScope 51DPackageModule {
227
+ Describe 'Update-NodePackageDependencies' {
228
+ It 'successfully update the package version' {
229
+ $depRepo = "dependent-node"
230
+ $repoName = "test-node"
231
+ $repoConfigStr = @"
232
+ {
233
+ "version": "4.3.0",
234
+ "packageName": "test.node",
235
+ "dependencies": [
236
+ "$depRepo"
237
+ ]
238
+ }
239
+ "@
240
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
241
+ $reposStr = @"
242
+ {
243
+ "$repoName": $repoConfigStr,
244
+ "$depRepo": {
245
+ "version": "4.3.0",
246
+ "packageName": "dep.node"
247
+ }
248
+ }
249
+ "@
250
+ $repos = $reposStr | ConvertFrom-Json
251
+ $configStr = @"
252
+ {
253
+ "repositories": $reposStr
254
+ }
255
+ "@
256
+ $config = $configStr | ConvertFrom-Json
257
+
258
+ # Initialize script scope variable
259
+ Initialize-GlobalVariables -Configuration $config
260
+ Mock Update-NodeDependenciesSub { return $true } `
261
+ -ModuleName 51DPackageModule
262
+
263
+ $result = Update-NodePackageDependencies `
264
+ -RepositoryName $repoName `
265
+ -TeamProjectName "testproject"
266
+ $result | Should -BeExactly $true
267
+ }
268
+
269
+ It 'failed to update package dependencies' {
270
+ $depRepo = "dependent-node"
271
+ $repoName = "test-node"
272
+ $repoConfigStr = @"
273
+ {
274
+ "version": "4.3.0",
275
+ "packageName": "test.node",
276
+ "dependencies": [
277
+ "$depRepo"
278
+ ]
279
+ }
280
+ "@
281
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
282
+ $reposStr = @"
283
+ {
284
+ "$repoName": $repoConfigStr,
285
+ "$depRepo": {
286
+ "version": "4.3.0",
287
+ "packageName": "dep.node"
288
+ }
289
+ }
290
+ "@
291
+ $repos = $reposStr | ConvertFrom-Json
292
+ $configStr = @"
293
+ {
294
+ "repositories": $reposStr
295
+ }
296
+ "@
297
+ $config = $configStr | ConvertFrom-Json
298
+
299
+ # Initialize script scope variable
300
+ Initialize-GlobalVariables -Configuration $config
301
+ Mock Update-NodeDependenciesSub { return $false } `
302
+ -ModuleName 51DPackageModule
303
+
304
+ $result = Update-NodePackageDependencies `
305
+ -RepositoryName $repoName `
306
+ -TeamProjectName "testproject"
307
+ $result | Should -BeExactly $false
308
+ }
309
+ }
310
+
311
+ Describe 'Update-NodePackageDependency' {
312
+ BeforeAll {
313
+ function Test-NodeSuccessfulVersionUpdate {
314
+ param (
315
+ [string]$SourceVersion
316
+ )
317
+
318
+ $depRepo = "dependent-node"
319
+ $repoName = "test-node"
320
+ $repoConfigStr = @"
321
+ {
322
+ "version": "4.3.0",
323
+ "packageName": "test.node",
324
+ "dependencies": [
325
+ "$depRepo"
326
+ ]
327
+ }
328
+ "@
329
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
330
+ $reposStr = @"
331
+ {
332
+ "$repoName": $repoConfigStr,
333
+ "$depRepo": {
334
+ "version": "4.3.0",
335
+ "packageName": "dep.node"
336
+ }
337
+ }
338
+ "@
339
+ $repos = $reposStr | ConvertFrom-Json
340
+ $configStr = @"
341
+ {
342
+ "repositories": $reposStr
343
+ }
344
+ "@
345
+ $config = $configStr | ConvertFrom-Json
346
+
347
+ # Initialize script scope variable
348
+ Initialize-GlobalVariables -Configuration $config
349
+ Mock Test-TagExist { return $true } `
350
+ -ModuleName 51DPackageModule
351
+ $content = '"dep.node.test" : "^$SourceVersion"'
352
+ $updatedContent = Update-NodePackageDependency `
353
+ -RepositoryName $depRepo `
354
+ -PackageFileContent $content `
355
+ -IsRemotePackage $false `
356
+ -TeamProjectName "testproject"
357
+ $updatedContent | Should -BeExactly '"dep.node.test": "^4.3.0"'
358
+ }
359
+ }
360
+
361
+ It 'successfully update the file content with well formed version' {
362
+ Test-NodeSuccessfulVersionUpdate -SourceVersion "0.0.0"
363
+ }
364
+
365
+ It 'successfully update the file content with non release well formed version' {
366
+ Test-NodeSuccessfulVersionUpdate -SourceVersion "0.0.0-beta.18+1"
367
+ }
368
+
369
+ It 'successfully update the file content of remote-package.json' {
370
+ $depRepo = "dependent-node"
371
+ $repoName = "test-node"
372
+ $repoConfigStr = @"
373
+ {
374
+ "version": "4.3.0",
375
+ "packageName": "test.node",
376
+ "dependencies": [
377
+ "$depRepo"
378
+ ]
379
+ }
380
+ "@
381
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
382
+ $reposStr = @"
383
+ {
384
+ "$repoName": $repoConfigStr,
385
+ "$depRepo": {
386
+ "version": "4.3.0",
387
+ "packageName": "dep.node"
388
+ }
389
+ }
390
+ "@
391
+ $repos = $reposStr | ConvertFrom-Json
392
+ $configStr = @"
393
+ {
394
+ "repositories": $reposStr
395
+ }
396
+ "@
397
+ $config = $configStr | ConvertFrom-Json
398
+
399
+ # Initialize script scope variable
400
+ Initialize-GlobalVariables -Configuration $config
401
+ Mock Test-TagExist { return $false } `
402
+ -ModuleName 51DPackageModule
403
+ $content = '"dep.node.test" : "^0.0.0"'
404
+ $updatedContent = Update-NodePackageDependency `
405
+ -RepositoryName $depRepo `
406
+ -PackageFileContent $content `
407
+ -IsRemotePackage $true `
408
+ -TeamProjectName "testproject"
409
+ $updatedContent | Should -BeExactly '"dep.node.test": "^4.3.0"'
410
+ }
411
+ }
412
+ }
413
+
414
+ InModuleScope '51DPackageModule' {
415
+ Describe 'Update-DotnetPackageFileContent' {
416
+ BeforeAll {
417
+ function Test-DotnetSuccessfulVersionUpdateOneLineBase {
418
+ param (
419
+ [string]$SourceVersion,
420
+ [string]$ConfigDepPackageName,
421
+ [string]$ActualDepPackageName
422
+ )
423
+
424
+ $depRepo = "dependent-dotnet"
425
+ $repoName = "test-dotnet"
426
+ $repoConfigStr = @"
427
+ {
428
+ "version": "4.3.0",
429
+ "packageName": "test.dotnet",
430
+ "dependencies": [
431
+ "$depRepo"
432
+ ]
433
+ }
434
+ "@
435
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
436
+ $reposStr = @"
437
+ {
438
+ "$repoName": $repoConfigStr,
439
+ "$depRepo": {
440
+ "version": "4.3.0",
441
+ "packageName": "$ConfigDepPackageName"
442
+ }
443
+ }
444
+ "@
445
+ $repos = $reposStr | ConvertFrom-Json
446
+
447
+ $configStr = @"
448
+ {
449
+ "repositories": $reposStr
450
+ }
451
+ "@
452
+ $config = $configStr | ConvertFrom-Json
453
+
454
+ # Initialize script scope variable
455
+ Initialize-GlobalVariables -Configuration $config
456
+
457
+ Mock Test-TagExist { return $true } `
458
+ -ModuleName 51DPackageModule
459
+ $content = "<PackageReference Include=`"$ActualDepPackageName`" Version=`"$SourceVersion`" />"
460
+
461
+ $updatedContent = Update-DotnetPackageFileContent `
462
+ -Dependencies $repoConfig.dependencies `
463
+ -ProjectFileContent $content `
464
+ -TeamProjectName "testproject" `
465
+ -IsPackagesConfig $false
466
+
467
+ $updatedContent | Should -BeExactly "<PackageReference Include=`"$ActualDepPackageName`" Version=`"4.3.0`" />"
468
+ }
469
+
470
+ function Test-DotnetSuccessfulVersionUpdateOneLine {
471
+ param (
472
+ [string]$SourceVersion
473
+ )
474
+ Test-DotnetSuccessfulVersionUpdateOneLineBase `
475
+ -SourceVersion $SourceVersion `
476
+ -ConfigDepPackageName "dep.dotnet" `
477
+ -ActualDepPackageName "dep.dotnet"
478
+ }
479
+
480
+ function Test-DotnetSuccessfulVersionUpdateOneLineRegex {
481
+ param (
482
+ [string]$SourceVersion
483
+ )
484
+ Test-DotnetSuccessfulVersionUpdateOneLineBase `
485
+ -SourceVersion $SourceVersion `
486
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
487
+ -ActualDepPackageName "dep.dotnet"
488
+ }
489
+
490
+ function Test-DotnetSuccessfulVersionUpdateMultiLinesBase {
491
+ param (
492
+ [string]$SourceVersion,
493
+ [string]$ConfigDepPackageName,
494
+ [string]$ActualDepPackageName
495
+ )
496
+
497
+ $depRepo = "dependent-dotnet"
498
+ $repoName = "test-dotnet"
499
+ $repoConfigStr = @"
500
+ {
501
+ "version": "4.3.0",
502
+ "packageName": "test.dotnet",
503
+ "dependencies": [
504
+ "$depRepo"
505
+ ]
506
+ }
507
+ "@
508
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
509
+ $reposStr = @"
510
+ {
511
+ "$repoName": $repoConfigStr,
512
+ "$depRepo": {
513
+ "version": "4.3.0",
514
+ "packageName": "$ConfigDepPackageName"
515
+ }
516
+ }
517
+ "@
518
+ $repos = $reposStr | ConvertFrom-Json
519
+
520
+ $configStr = @"
521
+ {
522
+ "repositories": $reposStr
523
+ }
524
+ "@
525
+ $config = $configStr | ConvertFrom-Json
526
+
527
+ Mock Test-TagExist { return $true } `
528
+ -ModuleName 51DPackageModule
529
+
530
+ # Initialize script scope variable
531
+ Initialize-GlobalVariables -Configuration $config
532
+
533
+ $content = "<PackageReference Include=`"$ActualDepPackageName`">`r`n<Version>$SourceVersion</Version>`r`n</PackageReference>"
534
+
535
+ $updatedContent = Update-DotnetPackageFileContent `
536
+ -Dependencies $repoConfig.dependencies `
537
+ -ProjectFileContent $content `
538
+ -TeamProjectName "testproject" `
539
+ -IsPackagesConfig $false
540
+
541
+ $updatedContent | Should -BeExactly "<PackageReference Include=`"$ActualDepPackageName`">`r`n<Version>4.3.0</Version>`r`n</PackageReference>"
542
+ }
543
+
544
+ function Test-DotnetSuccessfulVersionUpdateMultiLines {
545
+ param (
546
+ [string]$SourceVersion
547
+ )
548
+ Test-DotnetSuccessfulVersionUpdateMultiLinesBase `
549
+ -SourceVersion $SourceVersion `
550
+ -ConfigDepPackageName "dep.dotnet" `
551
+ -ActualDepPackageName "dep.dotnet"
552
+ }
553
+
554
+ function Test-DotnetSuccessfulVersionUpdateMultiLinesRegex {
555
+ param (
556
+ [string]$SourceVersion
557
+ )
558
+ Test-DotnetSuccessfulVersionUpdateMultiLinesBase `
559
+ -SourceVersion $SourceVersion `
560
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
561
+ -ActualDepPackageName "dep.dotnet"
562
+ }
563
+
564
+ function Test-DotnetSuccessfulVersionUpdateNetFrameworkProjectBase {
565
+ param (
566
+ [string]$SourceVersion,
567
+ [string]$ConfigDepPackageName,
568
+ [string]$ActualDepPackageName
569
+ )
570
+
571
+ $depRepo = "dependent-dotnet"
572
+ $repoName = "test-dotnet"
573
+ $repoConfigStr = @"
574
+ {
575
+ "version": "4.3.0",
576
+ "packageName": "test.dotnet",
577
+ "dependencies": [
578
+ "$depRepo"
579
+ ]
580
+ }
581
+ "@
582
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
583
+ $reposStr = @"
584
+ {
585
+ "$repoName": $repoConfigStr,
586
+ "$depRepo": {
587
+ "version": "4.3.0",
588
+ "packageName": "$ConfigDepPackageName"
589
+ }
590
+ }
591
+ "@
592
+ $repos = $reposStr | ConvertFrom-Json
593
+
594
+ $configStr = @"
595
+ {
596
+ "repositories": $reposStr
597
+ }
598
+ "@
599
+ $config = $configStr | ConvertFrom-Json
600
+
601
+ Mock Test-TagExist { return $true } `
602
+ -ModuleName 51DPackageModule
603
+
604
+ # Initialize script scope variable
605
+ Initialize-GlobalVariables -Configuration $config
606
+
607
+ $content = "<HintPath>..\..\..\..\..\packages\$($ActualDepPackageName).test.$($SourceVersion)\lib\netstandard2.0\dep.dotnet.test.dll</HintPath>"
608
+
609
+ $updatedContent = Update-DotnetPackageFileContent `
610
+ -Dependencies $repoConfig.dependencies `
611
+ -ProjectFileContent $content `
612
+ -TeamProjectName "testproject" `
613
+ -IsPackagesConfig $false
614
+
615
+ $updatedContent | Should -BeExactly "<HintPath>..\..\..\..\..\packages\$($ActualDepPackageName).test.4.3.0\lib\netstandard2.0\dep.dotnet.test.dll</HintPath>"
616
+ }
617
+
618
+ function Test-DotnetSuccessfulVersionUpdateNetFrameworkProject {
619
+ param (
620
+ [string]$SourceVersion
621
+ )
622
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkProjectBase `
623
+ -SourceVersion $SourceVersion `
624
+ -ConfigDepPackageName "dep.dotnet" `
625
+ -ActualDepPackageName "dep.dotnet"
626
+ }
627
+
628
+ function Test-DotnetSuccessfulVersionUpdateNetFrameworkProjectRegex {
629
+ param (
630
+ [string]$SourceVersion
631
+ )
632
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkProjectBase `
633
+ -SourceVersion $SourceVersion `
634
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
635
+ -ActualDepPackageName "dep.dotnet"
636
+ }
637
+
638
+ function Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfigBase {
639
+ param (
640
+ [string]$SourceVersion,
641
+ [string]$ConfigDepPackageName,
642
+ [string]$ActualDepPackageName
643
+ )
644
+
645
+ $depRepo = "dependent-dotnet"
646
+ $repoName = "test-dotnet"
647
+ $repoConfigStr = @"
648
+ {
649
+ "version": "4.3.0",
650
+ "packageName": "test.dotnet",
651
+ "dependencies": [
652
+ "$depRepo"
653
+ ]
654
+ }
655
+ "@
656
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
657
+ $reposStr = @"
658
+ {
659
+ "$repoName": $repoConfigStr,
660
+ "$depRepo": {
661
+ "version": "4.3.0",
662
+ "packageName": "$ConfigDepPackageName"
663
+ }
664
+ }
665
+ "@
666
+ $repos = $reposStr | ConvertFrom-Json
667
+
668
+ $configStr = @"
669
+ {
670
+ "repositories": $reposStr
671
+ }
672
+ "@
673
+ $config = $configStr | ConvertFrom-Json
674
+
675
+ Mock Test-TagExist { return $true } `
676
+ -ModuleName 51DPackageModule
677
+
678
+ # Initialize script scope variable
679
+ Initialize-GlobalVariables -Configuration $config
680
+
681
+ $content = "<package id=`"$($ActualDepPackageName).test`" version=`"$SourceVersion`" targetFramework=`"net472`" />"
682
+
683
+ $updatedContent = Update-DotnetPackageFileContent `
684
+ -Dependencies $repoConfig.dependencies `
685
+ -ProjectFileContent $content `
686
+ -TeamProjectName "testproject" `
687
+ -IsPackagesConfig $true
688
+
689
+ $updatedContent | Should -BeExactly "<package id=`"$($ActualDepPackageName).test`" version=`"4.3.0`" targetFramework=`"net472`" />"
690
+ }
691
+
692
+ function Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfig {
693
+ param (
694
+ [string]$SourceVersion
695
+ )
696
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfigBase `
697
+ -SourceVersion $SourceVersion `
698
+ -ConfigDepPackageName "dep.dotnet" `
699
+ -ActualDepPackageName "dep.dotnet"
700
+ }
701
+
702
+ function Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfigRegex {
703
+ param (
704
+ [string]$SourceVersion
705
+ )
706
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfigBase `
707
+ -SourceVersion $SourceVersion `
708
+ -ConfigDepPackageName "dep.(dotnet|SomethingElse)" `
709
+ -ActualDepPackageName "dep.dotnet"
710
+ }
711
+ }
712
+ It 'successfully update the well formed package version xml syntax `<PackageReference `/`>' {
713
+ Test-DotnetSuccessfulVersionUpdateOneLine -SourceVersion "0.0.0"
714
+ }
715
+
716
+ It 'successfully update the well formed package version xml syntax `<PackageReference `/`> with regex' {
717
+ Test-DotnetSuccessfulVersionUpdateOneLineRegex -SourceVersion "0.0.0"
718
+ }
719
+
720
+ It 'successfully update the non release well formed package version xml syntax `<PackageReference `/`>' {
721
+ Test-DotnetSuccessfulVersionUpdateOneLine -SourceVersion "0.0.0-beta.18+1"
722
+ }
723
+
724
+ It 'successfully update the non release well formed package version xml syntax `<PackageReference `/`> with regex' {
725
+ Test-DotnetSuccessfulVersionUpdateOneLineRegex -SourceVersion "0.0.0-beta.18+1"
726
+ }
727
+
728
+ It 'successfully update the well formed package version xml syntax `<PackageReference`>`<`/PackageReference`>' {
729
+ Test-DotnetSuccessfulVersionUpdateMultiLines -SourceVersion "0.0.0"
730
+ }
731
+
732
+ It 'successfully update the well formed package version xml syntax `<PackageReference`>`<`/PackageReference`> with regex' {
733
+ Test-DotnetSuccessfulVersionUpdateMultiLinesRegex -SourceVersion "0.0.0"
734
+ }
735
+
736
+ It 'successfully update the non well formed package version xml syntax `<PackageReference`>`<`/PackageReference`>' {
737
+ Test-DotnetSuccessfulVersionUpdateMultiLines -SourceVersion "0.0.0-beta.18+1"
738
+ }
739
+
740
+ It 'successfully update the non well formed package version xml syntax `<PackageReference`>`<`/PackageReference`> with regex' {
741
+ Test-DotnetSuccessfulVersionUpdateMultiLines -SourceVersion "0.0.0-beta.18+1"
742
+ }
743
+
744
+ It 'successfully update the well formed package version xml dotnet framework syntax' {
745
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkProject -SourceVersion "0.0.0"
746
+ }
747
+
748
+ It 'successfully update the well formed package version xml dotnet framework syntax with regex' {
749
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkProjectRegex -SourceVersion "0.0.0"
750
+ }
751
+
752
+ It 'successfully update the non well formed package version xml dotnet framework syntax' {
753
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkProject -SourceVersion "0.0.0-beta.18+1"
754
+ }
755
+
756
+ It 'successfully update the non well formed package version xml dotnet framework syntax with regex' {
757
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkProjectRegex -SourceVersion "0.0.0-beta.18+1"
758
+ }
759
+
760
+ It 'successfully update the well formed package version xml dotnet framework packages config file' {
761
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfig -SourceVersion "0.0.0"
762
+ }
763
+
764
+ It 'successfully update the well formed package version xml dotnet framework packages config file with regex' {
765
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfigRegex -SourceVersion "0.0.0"
766
+ }
767
+
768
+ It 'successfully update the non well formed package version xml dotnet framework packages config file' {
769
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfig -SourceVersion "0.0.0-beta.18+1"
770
+ }
771
+
772
+ It 'successfully update the non well formed package version xml dotnet framework packages config file with regex' {
773
+ Test-DotnetSuccessfulVersionUpdateNetFrameworkPackagesConfigRegex -SourceVersion "0.0.0-beta.18+1"
774
+ }
775
+ }
776
+ }
777
+
778
+ InModuleScope 51DPackageModule {
779
+ Describe 'Update-MavenPackageFileContent' {
780
+ BeforeAll {
781
+ function Test-MavenSuccessfulVersionUpdate {
782
+ param (
783
+ [string]$SourceVersion
784
+ )
785
+
786
+ $depRepo = "dependent-java"
787
+ $repoName = "test-java"
788
+ $repoConfigStr = @"
789
+ {
790
+ "version": "4.3.0",
791
+ "packageName": "test",
792
+ "versionVariableName": "test.version",
793
+ "dependencies": [
794
+ "$depRepo"
795
+ ]
796
+ }
797
+ "@
798
+ $repoConfig = $repoConfigStr | ConvertFrom-Json
799
+ $reposStr = @"
800
+ {
801
+ "$repoName": $repoConfigStr,
802
+ "$depRepo": {
803
+ "version": "4.3.0",
804
+ "packageName": "dep",
805
+ "versionVariableName": "dep.version"
806
+ }
807
+ }
808
+ "@
809
+ $repos = $reposStr | ConvertFrom-Json
810
+ $configStr = @"
811
+ {
812
+ "repositories": $reposStr
813
+ }
814
+ "@
815
+ $config = $configStr | ConvertFrom-Json
816
+
817
+ Mock Test-TagExist { return $true } `
818
+ -ModuleName 51DPackageModule
819
+
820
+ # Initialize script scope variable
821
+ Initialize-GlobalVariables -Configuration $config
822
+
823
+ $content = '<dep.version>$SourceVersion</dep.version>'
824
+
825
+ $updatedContent = Update-MavenPackageFileContent `
826
+ -Dependencies $repoConfig.dependencies `
827
+ -PomContent $content `
828
+ -TeamProjectName "testproject"
829
+
830
+ $updatedContent | Should -BeExactly '<dep.version>4.3.0</dep.version>'
831
+ }
832
+ }
833
+
834
+ It 'successfully update the well formed package version' {
835
+ Test-MavenSuccessfulVersionUpdate -SourceVersion "0.0.0"
836
+ }
837
+
838
+ It 'successfully update the non-release well formed package version' {
839
+ Test-MavenSuccessfulVersionUpdate -SourceVersion "0.0.0-beta.18+1"
840
+ }
841
+ }
842
+ }