From a7f790709c6372f8fcf8ac74a25c0fd85c3ed97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Wed, 26 Jun 2024 17:09:57 +0200 Subject: [PATCH] split the tests --- test/Es6Syntax.test.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/test/Es6Syntax.test.ts b/test/Es6Syntax.test.ts index cbde862..d030bb7 100644 --- a/test/Es6Syntax.test.ts +++ b/test/Es6Syntax.test.ts @@ -9,19 +9,23 @@ describe('ES6 Syntax', () => { t = new Tournament(fnStub, '___n8n_data'); }); - test('arrow functions', () => { + test('arrow functions with static data', () => { const result = t.execute('{{ () => 1 }}', {}); expect(result instanceof Function).toBe(true); + expect((result as Function)()).toBe(1); }); - test.only('arrow function call', () => { - const result1 = t.execute('{{ () => key }}', { key: 'value' }); - expect(result1).toBeInstanceOf(Function); - expect((result1 as Function)()).toBe('value'); + test('arrow functions with dynamic data', () => { + const result = t.execute('{{ () => key }}', { key: 'value' }); - const result2 = t.execute('{{ (() => key)() }}', { key: 'value' }); - expect(result2).toBe('value'); + expect(result instanceof Function).toBe(true); + expect((result as Function)()).toBe(1); + }); + + test('arrow function immediately invoked', () => { + const result = t.execute('{{ (() => key)() }}', { key: 'value' }); + expect(result).toBe('value'); }); test('interpolation in template literals', () => {