File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 1
1
2
2
@ {
3
3
RootModule = ' CRX.psm1'
4
- ModuleVersion = ' 0.2.0 '
4
+ ModuleVersion = ' 0.2.1 '
5
5
GUID = ' b5433b6c-b423-4049-8c5e-b3a50566fcf2'
6
6
Author = ' Alan Plocieniak'
7
7
CompanyName = ' Alan Plocieniak'
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function Get-CRXUpdateInfo {
9
9
try {
10
10
$update = Invoke-RestMethod - Uri $url
11
11
$app = $update.gupdate.app
12
- if ($app -and $app.updatecheck ) {
12
+ if ($app -and $app.updatecheck -and $app .updatecheck.status -ne ' noupdate ' ) {
13
13
return [CRXUpdateInfo ]::new($app.updatecheck )
14
14
}
15
15
}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ if (-not (Get-Module -Name Pester)) {
4
4
Import-Module .\CRX\CRX.psm1 - Force
5
5
6
6
Describe ' CRX.Tests' {
7
- BeforeAll{
7
+ BeforeAll {
8
8
$testUrl = ' https://localhost.com/crx/blobs/ASuc5ohLVu-itAJfZqe6NgPkB0pCREbOH49PhxJq4pMdp7MWQx-ycGQt8dsD8WUSM_dTlB5sLwXljaUve7GTKh485NrRlNGdmT7O5aT9uS4R9jmIqNJBAMZSmuV9IZ0e0VV7jGd-rrI-YR5eoIra2Q/AOCLHCCCFDKJDDGPAAAJLDGLJHLLHGMD_4_0_0_0.crx'
9
9
$testExtensionId = ' aoclhcccfdkjddgpaaajldgljhllhgmd'
10
10
}
@@ -20,6 +20,24 @@ Describe 'CRX.Tests' {
20
20
$response = Get-CRXUpdateInfo " invalid"
21
21
$response | Should - BeNullOrEmpty
22
22
}
23
+
24
+ It ' Should return null when no update is available' {
25
+ Mock - CommandName Invoke-RestMethod - ModuleName CRX - MockWith {
26
+ param ($Uri , $OutFile )
27
+ return @ {
28
+ gupdate = @ {
29
+ app = @ {
30
+ updatecheck = @ {
31
+ status = ' noupdate'
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ $result = Get-CRXUpdateInfo - Id $testExtensionId
39
+ $result | Should - Be $null
40
+ }
23
41
}
24
42
25
43
Context ' Test-CRXUpdateAvailable' {
You can’t perform that action at this time.
0 commit comments