From d3023dcb26d8f289044ef29eedca1a7930fcdfb5 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@keylocation.sg>
Date: Thu, 20 Apr 2017 07:09:07 +0200
Subject: [PATCH] Add tests

---
 test/api/github.spec.js       | 22 ++++++++++++++++++++++
 test/helpers/versions.spec.js |  4 ++++
 2 files changed, 26 insertions(+)

diff --git a/test/api/github.spec.js b/test/api/github.spec.js
index 494e585699..de08142728 100644
--- a/test/api/github.spec.js
+++ b/test/api/github.spec.js
@@ -204,6 +204,28 @@ describe('api/github', () => {
       expect(pr).toMatchSnapshot();
     });
   });
+  describe('getBranchStatus(branchName)', () => {
+    it('should return true', async () => {
+      await initRepo('some/repo', 'token');
+      ghGot.mockImplementationOnce(() => ({
+        body: {
+          state: true,
+        },
+      }));
+      const res = await github.getBranchStatus('somebranch');
+      expect(res).toEqual(true);
+    });
+    it('should return false', async () => {
+      await initRepo('some/repo', 'token');
+      ghGot.mockImplementationOnce(() => ({
+        body: {
+          state: false,
+        },
+      }));
+      const res = await github.getBranchStatus('somebranch');
+      expect(res).toEqual(false);
+    });
+  });
   describe('addAssignees(issueNo, assignees)', () => {
     it('should add the given assignees to the issue', async () => {
       await initRepo('some/repo', 'token');
diff --git a/test/helpers/versions.spec.js b/test/helpers/versions.spec.js
index b3e0df1f78..d370f31e45 100644
--- a/test/helpers/versions.spec.js
+++ b/test/helpers/versions.spec.js
@@ -290,6 +290,10 @@ describe('helpers/versions', () => {
       const config = Object.assign({}, defaultConfig, { pinVersions: false });
       expect(versionsHelper.determineUpgrades(qJson, '<= 0.7.2', config)).toEqual(upgradeVersions);
     });
+    it('rejects less than ranges without pinning', () => {
+      const config = Object.assign({}, defaultConfig, { pinVersions: false });
+      expect(versionsHelper.determineUpgrades(qJson, '< 0.7.2', config)).toEqual([]);
+    });
     it('supports > latest versions if configured', () => {
       const config = Object.assign({}, defaultConfig);
       config.respectLatest = false;
-- 
GitLab