github.com/outbrain/consul@v1.4.5/ui-v2/tests/unit/utils/callable-type-test.js (about) 1 import callableType from 'consul-ui/utils/callable-type'; 2 import { module, test } from 'qunit'; 3 // TODO: Sure there's a better name for this 4 module('Unit | Utility | callable type'); 5 6 test('returns a function returning the string', function(assert) { 7 const expected = 'hi'; 8 const actual = callableType(expected)(); 9 assert.equal(actual, expected); 10 }); 11 test('returns the same function if you pass it a function', function(assert) { 12 const expected = 'hi'; 13 const actual = callableType(function() { 14 return 'hi'; 15 })(); 16 assert.equal(actual, expected); 17 });