FIX: errors in qunit tests when version check info is missing

FIX: errors in qunit tests when version check info is missing

diff --git a/app/assets/javascripts/admin/models/version-check.js.es6 b/app/assets/javascripts/admin/models/version-check.js.es6
index ba0bdf0..ce41d66 100644
--- a/app/assets/javascripts/admin/models/version-check.js.es6
+++ b/app/assets/javascripts/admin/models/version-check.js.es6
@@ -19,16 +19,18 @@ const VersionCheck = Discourse.Model.extend({
 
   @computed("git_branch", "installed_sha")
   gitLink(gitBranch, installedSHA) {
-    if (gitBranch) {
+    if (gitBranch && installedSHA) {
       return `https://github.com/discourse/discourse/compare/${installedSHA}...${gitBranch}`;
-    } else {
+    } else if (installedSHA) {
       return `https://github.com/discourse/discourse/tree/${installedSHA}`;
     }
   },
 
   @computed("installed_sha")
   shortSha(installedSHA) {
-    return installedSHA.substr(0, 10);
+    if (installedSHA) {
+      return installedSHA.substr(0, 10);
+    }
   }
 });
 
diff --git a/app/assets/javascripts/admin/templates/version-checks.hbs b/app/assets/javascripts/admin/templates/version-checks.hbs
index 60dd8a8..ced3da8 100644
--- a/app/assets/javascripts/admin/templates/version-checks.hbs
+++ b/app/assets/javascripts/admin/templates/version-checks.hbs
@@ -6,9 +6,11 @@
       <div class="version-number">
         <h4>{{i18n 'admin.dashboard.installed_version'}}</h4>
         <h3>{{dash-if-empty versionCheck.installed_version}}</h3>
-        <div class="sha-link">
-          (<a href={{versionCheck.gitLink}} target="_blank">{{versionCheck.shortSha}}</a>)
-        </div>
+        {{#if versionCheck.gitLink}}
+          <div class="sha-link">
+            (<a href={{versionCheck.gitLink}} target="_blank">{{versionCheck.shortSha}}</a>)
+          </div>
+        {{/if}}
       </div>
 
       {{#if versionCheck.noCheckPerformed}}

GitHub sha: f0586ece

1 Like