@@ -4,8 +4,8 @@ import mem from '.';
44
55test ( 'memoize' , t => {
66let i = 0 ;
7- const f = ( ) => i ++ ;
8- const memoized = mem ( f ) ;
7+ const fixture = ( ) => i ++ ;
8+ const memoized = mem ( fixture ) ;
99t . is ( memoized ( ) , 0 ) ;
1010t . is ( memoized ( ) , 0 ) ;
1111t . is ( memoized ( ) , 0 ) ;
@@ -41,25 +41,25 @@ test.failing('memoize with regexp arguments', t => {
4141
4242test . failing ( 'memoize with Symbol arguments' , t => {
4343let i = 0 ;
44- const arg1 = Symbol ( 'fixture1' ) ;
45- const arg2 = Symbol ( 'fixture2' ) ;
44+ const argument1 = Symbol ( 'fixture1' ) ;
45+ const argument2 = Symbol ( 'fixture2' ) ;
4646const memoized = mem ( ( ) => i ++ ) ;
4747t . is ( memoized ( ) , 0 ) ;
4848t . is ( memoized ( ) , 0 ) ;
49- t . is ( memoized ( arg1 ) , 1 ) ;
50- t . is ( memoized ( arg1 ) , 1 ) ;
51- t . is ( memoized ( arg2 ) , 2 ) ;
52- t . is ( memoized ( arg2 ) , 2 ) ;
53- t . is ( memoized ( { foo :arg1 } ) , 3 ) ;
54- t . is ( memoized ( { foo :arg1 } ) , 3 ) ;
55- t . is ( memoized ( { foo :arg2 } ) , 4 ) ;
56- t . is ( memoized ( { foo :arg2 } ) , 4 ) ;
49+ t . is ( memoized ( argument1 ) , 1 ) ;
50+ t . is ( memoized ( argument1 ) , 1 ) ;
51+ t . is ( memoized ( argument2 ) , 2 ) ;
52+ t . is ( memoized ( argument2 ) , 2 ) ;
53+ t . is ( memoized ( { foo :argument1 } ) , 3 ) ;
54+ t . is ( memoized ( { foo :argument1 } ) , 3 ) ;
55+ t . is ( memoized ( { foo :argument2 } ) , 4 ) ;
56+ t . is ( memoized ( { foo :argument2 } ) , 4 ) ;
5757} ) ;
5858
5959test ( 'maxAge option' , async t => {
6060let i = 0 ;
61- const f = ( ) => i ++ ;
62- const memoized = mem ( f , { maxAge :100 } ) ;
61+ const fixture = ( ) => i ++ ;
62+ const memoized = mem ( fixture , { maxAge :100 } ) ;
6363t . is ( memoized ( 1 ) , 0 ) ;
6464t . is ( memoized ( 1 ) , 0 ) ;
6565await delay ( 50 ) ;
@@ -70,7 +70,7 @@ test('maxAge option', async t => {
7070
7171test ( 'maxAge option deletes old items' , async t => {
7272let i = 0 ;
73- const f = ( ) => i ++ ;
73+ const fixture = ( ) => i ++ ;
7474const cache = new Map ( ) ;
7575const deleted = [ ] ;
7676const remove = cache . delete . bind ( cache ) ;
@@ -79,7 +79,7 @@ test('maxAge option deletes old items', async t => {
7979return remove ( item ) ;
8080} ;
8181
82- const memoized = mem ( f , { maxAge :100 , cache} ) ;
82+ const memoized = mem ( fixture , { maxAge :100 , cache} ) ;
8383t . is ( memoized ( 1 ) , 0 ) ;
8484t . is ( memoized ( 1 ) , 0 ) ;
8585t . is ( cache . has ( 1 ) , true ) ;
@@ -94,7 +94,7 @@ test('maxAge option deletes old items', async t => {
9494
9595test ( 'maxAge items are deleted even if function throws' , async t => {
9696let i = 0 ;
97- const f = ( ) => {
97+ const fixture = ( ) => {
9898if ( i === 1 ) {
9999throw new Error ( 'failure' ) ;
100100}
@@ -103,7 +103,7 @@ test('maxAge items are deleted even if function throws', async t => {
103103} ;
104104
105105const cache = new Map ( ) ;
106- const memoized = mem ( f , { maxAge :100 , cache} ) ;
106+ const memoized = mem ( fixture , { maxAge :100 , cache} ) ;
107107t . is ( memoized ( 1 ) , 0 ) ;
108108t . is ( memoized ( 1 ) , 0 ) ;
109109t . is ( cache . size , 1 ) ;
@@ -116,8 +116,8 @@ test('maxAge items are deleted even if function throws', async t => {
116116
117117test ( 'cacheKey option' , t => {
118118let i = 0 ;
119- const f = ( ) => i ++ ;
120- const memoized = mem ( f , { cacheKey :x => x } ) ;
119+ const fixture = ( ) => i ++ ;
120+ const memoized = mem ( fixture , { cacheKey :x => x } ) ;
121121t . is ( memoized ( 1 ) , 0 ) ;
122122t . is ( memoized ( 1 ) , 0 ) ;
123123t . is ( memoized ( 1 , 2 ) , 0 ) ;
@@ -127,8 +127,8 @@ test('cacheKey option', t => {
127127
128128test ( 'cache option' , t => {
129129let i = 0 ;
130- const f = ( ) => i ++ ;
131- const memoized = mem ( f , {
130+ const fixture = ( ) => i ++ ;
131+ const memoized = mem ( fixture , {
132132cache :new WeakMap ( ) ,
133133cacheKey :x => x
134134} ) ;
@@ -196,8 +196,8 @@ test('preserves the original function name', t => {
196196
197197test ( '.clear()' , t => {
198198let i = 0 ;
199- const f = ( ) => i ++ ;
200- const memoized = mem ( f ) ;
199+ const fixture = ( ) => i ++ ;
200+ const memoized = mem ( fixture ) ;
201201t . is ( memoized ( ) , 0 ) ;
202202t . is ( memoized ( ) , 0 ) ;
203203mem . clear ( memoized ) ;
@@ -206,15 +206,15 @@ test('.clear()', t => {
206206} ) ;
207207
208208test ( 'prototype support' , t => {
209- const f = function ( ) {
209+ const fixture = function ( ) {
210210return this . i ++ ;
211211} ;
212212
213213const Unicorn = function ( ) {
214214this . i = 0 ;
215215} ;
216216
217- Unicorn . prototype . foo = mem ( f ) ;
217+ Unicorn . prototype . foo = mem ( fixture ) ;
218218
219219const unicorn = new Unicorn ( ) ;
220220