field.test.js (502B)
1 const tape = require('tape'); 2 const field = require('./field'); 3 4 function pass( arg ) { 5 return arg; 6 } 7 8 tape('Ensure basics', async t => { 9 t.plan(1); 10 t.equal(typeof field, 'function', 'Field is an exported function'); 11 }); 12 13 tape('Function passthrough', async t => { 14 t.plan(1); 15 t.equal(field('foo',{foo:'bar'},pass), 'bar', 'Fetch field by name works'); 16 }); 17 18 tape('Pass to explicit', async t => { 19 t.plan(1); 20 t.equal(field('<implicit>',{foo:'bar'},pass), 'bar', 'Implicit fetch works'); 21 });