From 78271c818a1a0bc927b27bb1bb7773f93f6b6b14 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sat, 6 Oct 2018 07:27:43 +0200
Subject: [PATCH] chore: refactor cached changelog test (#2607)

---
 test/workers/pr/changelog/index.spec.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/workers/pr/changelog/index.spec.js b/test/workers/pr/changelog/index.spec.js
index 9f16a59261..c59e65c5fe 100644
--- a/test/workers/pr/changelog/index.spec.js
+++ b/test/workers/pr/changelog/index.spec.js
@@ -104,13 +104,13 @@ describe('workers/pr/changelog', () => {
       ).toMatchSnapshot();
     });
     it('returns cached JSON', async () => {
-      const first = await getChangeLogJSON({ ...upgrade });
-      const firstCalls = [...ghGot.mock.calls];
       ghGot.mockClear();
+      const first = await getChangeLogJSON({ ...upgrade });
+      const firstCallsCount = ghGot.mock.calls.length;
       const second = await getChangeLogJSON({ ...upgrade });
-      const secondCalls = [...ghGot.mock.calls];
+      const secondCallsCount = ghGot.mock.calls.length - firstCallsCount;
       expect(first).toEqual(second);
-      expect(firstCalls.length).toBeGreaterThan(secondCalls.length);
+      expect(firstCallsCount).toBeGreaterThan(secondCallsCount);
     });
     it('filters unnecessary warns', async () => {
       ghGot.mockImplementation(() => {
-- 
GitLab