From 60f28fd07076f0740ab96413bdf6a46e1d83b6d1 Mon Sep 17 00:00:00 2001 From: Elvin Peng <elvin.pjw@gmail.com> Date: Sat, 12 Jan 2019 21:54:56 -0600 Subject: [PATCH] Add failing tests for RegExp and Symbol arguments (#21) --- test.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test.js b/test.js index 7c8cf89..4ea6423 100644 --- a/test.js +++ b/test.js @@ -28,6 +28,34 @@ test('memoize with multiple non-primitive arguments', t => { t.is(memoized({foo: true}, {bar: false}, {baz: true}), 2); }); +test.failing('memoize with regexp arguments', t => { + let i = 0; + const memoized = m(() => i++); + t.is(memoized(), 0); + t.is(memoized(), 0); + t.is(memoized(/Sindre Sorhus/), 1); + t.is(memoized(/Sindre Sorhus/), 1); + t.is(memoized(/Elvin Peng/), 2); + t.is(memoized(/Elvin Peng/), 2); +}); + +test.failing('memoize with Symbol arguments', t => { + let i = 0; + const arg1 = Symbol('fixture1'); + const arg2 = Symbol('fixture2'); + const memoized = m(() => i++); + t.is(memoized(), 0); + t.is(memoized(), 0); + t.is(memoized(arg1), 1); + t.is(memoized(arg1), 1); + t.is(memoized(arg2), 2); + t.is(memoized(arg2), 2); + t.is(memoized({foo: arg1}), 3); + t.is(memoized({foo: arg1}), 3); + t.is(memoized({foo: arg2}), 4); + t.is(memoized({foo: arg2}), 4); +}); + test('maxAge option', async t => { let i = 0; const f = () => i++;