fluentnode
Version:
Fluent apis for node (based on the concepts used in C#'s FluentSharp
61 lines (52 loc) • 1.91 kB
JavaScript
// Generated by CoffeeScript 1.12.7
(function() {
var Abc,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
require('../../src/fluentnode');
Abc = (function() {
function Abc() {
this.getValue_Inside_Abc = bind(this.getValue_Inside_Abc, this);
this.value = 'abc';
this.aaaaa = 'abc';
}
Abc.prototype.getValue = function() {
return this.value;
};
Abc.prototype.getValue_Inside_Abc = function() {
return this.value;
};
return Abc;
})();
describe('| js-native | Function', function() {
it('ctor', function() {
Abc.assert_Is_Function().ctor().assert_Is_Object().value.assert_Is('abc');
Abc.ctor()._str().assert_Is(new Abc()._str());
Abc.ctor().value.assert_Is_Not('def');
return ((new Abc()).keys_All()).assert_Contains('getValue');
});
it('invoke', function() {
var abc;
Abc.ctor().getValue.assert_Is_Function();
abc = new Abc();
(abc.getValue() !== void 0).assert_Is_True();
(abc.getValue.invoke() === void 0).assert_Is_True();
(abc.getValue_Inside_Abc() !== void 0).assert_Is_True();
(abc.getValue_Inside_Abc.invoke() !== void 0).assert_Is_True();
abc.getValue_Inside_Abc.invoke().assert_Is('abc');
abc.getValue_Inside_Abc.invoke().assert_Is(new Abc().value);
return abc.getValue_Inside_Abc.invoke().assert_Is(Abc.ctor().value);
});
it('invoke_In', function(done) {
done.invoke_In.assert_Is_Function();
return done.invoke_In(0);
});
return it('source_Code', function() {
var test;
test = new Function('return 42;');
test.assert_Is_Function();
test.source_Code.assert_Is_Function();
test.source_Code().assert_Is("function anonymous() {\nreturn 42;\n}");
return test.source_Code.assert_Is(test.sourceCode);
});
});
}).call(this);