First Commit of new way of building the Platform

This commit is contained in:
Luis Fernando Molina committed 2020-01-28 17:27:23 +01:00
1 parent e48cf0dae5
commit 40e60b42cc
4616 files changed
+713402

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
describe('one-time', function () {
'use strict';
var assume = require('assume')
, one = require('./');
it('is exported as a function', function () {
assume(one).is.a('function');
});
it('only calls the supplied function once', function (next) {
next = one(next);
next();
next();
next();
next();
});
it('returns the same value as the called function every single time', function () {
var foo = one(function () {
return 'bar';
});
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
assume(foo()).equals('bar');
});
it('the returned function uses the same displayName as the given fn', function () {
var foo = one(function banana() {
return 'bar';
});
assume(foo.displayName).equals('banana');
});
});