File tree Expand file tree Collapse file tree 3 files changed +21
-3
lines changed
Expand file tree Collapse file tree 3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 11
22@ {
33 RootModule = ' CRX.psm1'
4- ModuleVersion = ' 0.2.0 '
4+ ModuleVersion = ' 0.2.1 '
55 GUID = ' b5433b6c-b423-4049-8c5e-b3a50566fcf2'
66 Author = ' Alan Plocieniak'
77 CompanyName = ' Alan Plocieniak'
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ function Get-CRXUpdateInfo {
99 try {
1010 $update = Invoke-RestMethod - Uri $url
1111 $app = $update.gupdate.app
12- if ($app -and $app.updatecheck ) {
12+ if ($app -and $app.updatecheck -and $app .updatecheck.status -ne ' noupdate ' ) {
1313 return [CRXUpdateInfo ]::new($app.updatecheck )
1414 }
1515 }
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ if (-not (Get-Module -Name Pester)) {
44Import-Module .\CRX\CRX.psm1 - Force
55
66Describe ' CRX.Tests' {
7- BeforeAll{
7+ BeforeAll {
88 $testUrl = ' https://localhost.com/crx/blobs/ASuc5ohLVu-itAJfZqe6NgPkB0pCREbOH49PhxJq4pMdp7MWQx-ycGQt8dsD8WUSM_dTlB5sLwXljaUve7GTKh485NrRlNGdmT7O5aT9uS4R9jmIqNJBAMZSmuV9IZ0e0VV7jGd-rrI-YR5eoIra2Q/AOCLHCCCFDKJDDGPAAAJLDGLJHLLHGMD_4_0_0_0.crx'
99 $testExtensionId = ' aoclhcccfdkjddgpaaajldgljhllhgmd'
1010 }
@@ -20,6 +20,24 @@ Describe 'CRX.Tests' {
2020 $response = Get-CRXUpdateInfo " invalid"
2121 $response | Should - BeNullOrEmpty
2222 }
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+ }
2341 }
2442
2543 Context ' Test-CRXUpdateAvailable' {
You can’t perform that action at this time.
0 commit comments