Skip to content
Snippets Groups Projects
Unverified Commit 78271c81 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

chore: refactor cached changelog test (#2607)

parent c571df31
No related branches found
No related tags found
No related merge requests found
...@@ -104,13 +104,13 @@ describe('workers/pr/changelog', () => { ...@@ -104,13 +104,13 @@ describe('workers/pr/changelog', () => {
).toMatchSnapshot(); ).toMatchSnapshot();
}); });
it('returns cached JSON', async () => { it('returns cached JSON', async () => {
const first = await getChangeLogJSON({ ...upgrade });
const firstCalls = [...ghGot.mock.calls];
ghGot.mockClear(); ghGot.mockClear();
const first = await getChangeLogJSON({ ...upgrade });
const firstCallsCount = ghGot.mock.calls.length;
const second = await getChangeLogJSON({ ...upgrade }); const second = await getChangeLogJSON({ ...upgrade });
const secondCalls = [...ghGot.mock.calls]; const secondCallsCount = ghGot.mock.calls.length - firstCallsCount;
expect(first).toEqual(second); expect(first).toEqual(second);
expect(firstCalls.length).toBeGreaterThan(secondCalls.length); expect(firstCallsCount).toBeGreaterThan(secondCallsCount);
}); });
it('filters unnecessary warns', async () => { it('filters unnecessary warns', async () => {
ghGot.mockImplementation(() => { ghGot.mockImplementation(() => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment