From d8ea37fc591d554a9bec98e13dc9624178d923b2 Mon Sep 17 00:00:00 2001 From: Matt Phillips Date: Thu, 1 Aug 2019 08:37:04 +0100 Subject: [PATCH] Add test for single column heading with text elsewhere in template string --- .../jest-each/src/__tests__/template.test.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/jest-each/src/__tests__/template.test.ts b/packages/jest-each/src/__tests__/template.test.ts index 417344e4f9a3..ceed06503d8e 100644 --- a/packages/jest-each/src/__tests__/template.test.ts +++ b/packages/jest-each/src/__tests__/template.test.ts @@ -142,6 +142,27 @@ describe('jest-each', () => { ); }); + test('does not throw error when there is only one column with additional words in template after heading', () => { + const globalTestMocks = getGlobalTestMocks(); + const eachObject = each.withGlobal(globalTestMocks)` + a + hello world + ${1} + `; + const testFunction = get(eachObject, keyPath); + const testCallBack = jest.fn(); + testFunction('test title', testCallBack); + + const globalMock = get(globalTestMocks, keyPath); + + expect(globalMock).toHaveBeenCalledTimes(1); + expect(globalMock).toHaveBeenCalledWith( + 'test title', + expectFunction, + undefined, + ); + }); + test('throws error when there are no arguments for given headings', () => { const globalTestMocks = getGlobalTestMocks(); const eachObject = each.withGlobal(globalTestMocks)`