From fff10f43bde3eb60e261db97be3b4a3aa2f95ad9 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 10 Feb 2022 17:40:59 +0000 Subject: [PATCH 1/3] Failing test for `when` --- test/pattern.test.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/pattern.test.mjs b/test/pattern.test.mjs index 7fa8bdfe..ca594df2 100644 --- a/test/pattern.test.mjs +++ b/test/pattern.test.mjs @@ -178,6 +178,12 @@ describe('Pattern', function() { it('Never faster', function () { assert.equal(pure("a").when(pure(false), x => x._fast(2)).firstCycle.length, 1) }) + it('Can alternate', function () { + assert.deepStrictEqual( + pure(10).when(slowcat(true,false),add(3)).fast(4).firstCycle, + slowcat(10,13,10,10).firstCycle + ) + }) }) describe('fastcat()', function () { it('Can concatenate two things', function () { From a074c146ec226970385e828f37854c15359dba8e Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 10 Feb 2022 17:43:16 +0000 Subject: [PATCH 2/3] fix wrong values in test --- test/pattern.test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pattern.test.mjs b/test/pattern.test.mjs index ca594df2..5ba702fa 100644 --- a/test/pattern.test.mjs +++ b/test/pattern.test.mjs @@ -181,7 +181,7 @@ describe('Pattern', function() { it('Can alternate', function () { assert.deepStrictEqual( pure(10).when(slowcat(true,false),add(3)).fast(4).firstCycle, - slowcat(10,13,10,10).firstCycle + slowcat(13,10,13,10).firstCycle ) }) }) From f3a3376e247dc174d55738e126a90b02c2c61f2a Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 19 Feb 2022 15:06:35 +0000 Subject: [PATCH 3/3] It was the test that was wrong all along --- test/pattern.test.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pattern.test.mjs b/test/pattern.test.mjs index 5ba702fa..3778b963 100644 --- a/test/pattern.test.mjs +++ b/test/pattern.test.mjs @@ -180,8 +180,8 @@ describe('Pattern', function() { }) it('Can alternate', function () { assert.deepStrictEqual( - pure(10).when(slowcat(true,false),add(3)).fast(4).firstCycle, - slowcat(13,10,13,10).firstCycle + pure(10).when(slowcat(true,false),add(3)).fast(4)._sortEventsByPart().firstCycle, + fastcat(13,10,13,10).firstCycle ) }) })