From 350e8eae3f0fc1fe936068a2b320e95ed8ad3862 Mon Sep 17 00:00:00 2001 From: Kornel Dubieniecki Date: Mon, 14 Oct 2019 00:22:14 +0200 Subject: [PATCH] Apply the review suggestions --- .../src/__tests__/get_result_header.test.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/jest-reporters/src/__tests__/get_result_header.test.js b/packages/jest-reporters/src/__tests__/get_result_header.test.js index c692525a3a87..a11c24945d1b 100644 --- a/packages/jest-reporters/src/__tests__/get_result_header.test.js +++ b/packages/jest-reporters/src/__tests__/get_result_header.test.js @@ -18,19 +18,22 @@ const testResult = { const globalConfig = makeGlobalConfig(); -test('should call `terminal-link` correctly', () => { +beforeEach(() => { terminalLink.mockClear(); +}); +test('should call `terminal-link` correctly', () => { getResultHeader(testResult, globalConfig); - const call = terminalLink.mock.calls[0]; - expect(terminalLink).toHaveBeenCalled(); - expect(call[0]).toBe(formatTestPath(globalConfig, testResult.testFilePath)); - expect(call[1]).toBe(`file://${testResult.testFilePath}`); + expect(terminalLink).toBeCalledWith( + formatTestPath(globalConfig, testResult.testFilePath), + `file://${testResult.testFilePath}`, + expect.objectContaining({fallback: expect.any(Function)}), + ); }); -test('should render the output correctly', () => { +test('should render the terminal link', () => { const result = getResultHeader(testResult, globalConfig); - expect(result).toMatch(/wannabehyperlink/); + expect(result).toContain('wannabehyperlink'); });