fluentnode
Version:
Fluent apis for node (based on the concepts used in C#'s FluentSharp
286 lines (185 loc) • 9.43 kB
HTML
<html>
<head>
<title>console.test.coffee</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To …</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="Array.html">
Array.litcoffee
</a>
<a class="source" href="Boolean.html">
Boolean.litcoffee
</a>
<a class="source" href="Function.html">
Function.litcoffee
</a>
<a class="source" href="Number.html">
Number.litcoffee
</a>
<a class="source" href="Object.html">
Object.litcoffee
</a>
<a class="source" href="String.html">
String.litcoffee
</a>
<a class="source" href="_register.html">
_register.js
</a>
<a class="source" href="_to_map_and_write_Tests.html">
_to_map_and_write_Tests.litcoffee
</a>
<a class="source" href="assert_Array.html">
assert_Array.litcoffee
</a>
<a class="source" href="assert_Boolean.html">
assert_Boolean.litcoffee
</a>
<a class="source" href="assert_Function.html">
assert_Function.litcoffee
</a>
<a class="source" href="assert_Number.html">
assert_Number.litcoffee
</a>
<a class="source" href="assert_Object.html">
assert_Object.litcoffee
</a>
<a class="source" href="assert_String.html">
assert_String.litcoffee
</a>
<a class="source" href="console.html">
console.litcoffee
</a>
<a class="source" href="fs.html">
fs.litcoffee
</a>
<a class="source" href="globals.html">
globals.litcoffee
</a>
<a class="source" href="http.html">
http.litcoffee
</a>
<a class="source" href="index.html">
index.md
</a>
<a class="source" href="path.html">
path.litcoffee
</a>
<a class="source" href="process.html">
process.litcoffee
</a>
<a class="source" href="Array.test.html">
Array.test.coffee
</a>
<a class="source" href="Boolean.test.html">
Boolean.test.coffee
</a>
<a class="source" href="Function.test.html">
Function.test.coffee
</a>
<a class="source" href="Number.test.html">
Number.test.coffee
</a>
<a class="source" href="Object.test.html">
Object.test.coffee
</a>
<a class="source" href="String.test.html">
String.test.coffee
</a>
<a class="source" href="Array.test.html">
Array.test.coffee
</a>
<a class="source" href="Boolean.test.html">
Boolean.test.coffee
</a>
<a class="source" href="Function.test.html">
Function.test.coffee
</a>
<a class="source" href="Number.test.html">
Number.test.coffee
</a>
<a class="source" href="Object.test.html">
Object.test.coffee
</a>
<a class="source" href="String.test.html">
String.test.coffee
</a>
<a class="source" href="console.test.html">
console.test.coffee
</a>
<a class="source" href="fs.test.html">
fs.test.coffee
</a>
<a class="source" href="globals.test.html">
globals.test.coffee
</a>
<a class="source" href="http.test.html">
http.test.coffee
</a>
<a class="source" href="path.test.html">
path.test.coffee
</a>
<a class="source" href="process.test.html">
process.test.coffee
</a>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>console.test.coffee</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">require</span>(<span class="hljs-string">'../src/console'</span>)
<span class="hljs-built_in">require</span>(<span class="hljs-string">'../src/Array'</span>)
expect = <span class="hljs-built_in">require</span>(<span class="hljs-string">'chai'</span>).expect
describe <span class="hljs-string">'console'</span>,<span class="hljs-function">-></span>
original_log = <span class="hljs-literal">null</span>
log_Messages = <span class="hljs-literal">null</span>
beforeEach ->
original_log = <span class="hljs-built_in">console</span>.log
log_Messages = []
<span class="hljs-built_in">console</span>.log = <span class="hljs-function"><span class="hljs-params">(logMsg)</span>-></span> log_Messages.push(logMsg)
afterEach ->
<span class="hljs-built_in">console</span>.log = original_log
it <span class="hljs-string">'console_log'</span>, <span class="hljs-function">-></span>
expect(<span class="hljs-string">""</span>.console_log).to.be.an(<span class="hljs-string">'Function'</span>)
<span class="hljs-built_in">console</span>.log (<span class="hljs-string">'direct log msg'</span>)
returnValue = <span class="hljs-string">'msg using extension method'</span>.console_log()
expect(log_Messages).to.deep.equal([ <span class="hljs-string">'direct log msg'</span>, <span class="hljs-string">'msg using extension method'</span> ])
expect(returnValue ).to.equal(<span class="hljs-string">'msg using extension method'</span>)
it <span class="hljs-string">'Number.log'</span>,<span class="hljs-function">-></span>
expect((<span class="hljs-number">10</span>).log).to.be.an(<span class="hljs-string">'Function'</span>)
(<span class="hljs-number">10</span>).log()
expect(log_Messages).to.deep.equal([ <span class="hljs-string">"10"</span>])
it <span class="hljs-string">'{string}.log'</span>, <span class="hljs-function">-></span>
expect(<span class="hljs-string">""</span>.log).to.be.an(<span class="hljs-string">'Function'</span>)
<span class="hljs-string">"log using .log()"</span>.log()
expect(log_Messages).to.deep.equal([ <span class="hljs-string">"log using .log()"</span>])
it <span class="hljs-string">'{array}.log'</span>, <span class="hljs-function">-></span>
expect([].log).to.be.an(<span class="hljs-string">'Function'</span>)
target = [<span class="hljs-string">'1'</span>,<span class="hljs-string">'3'</span>,<span class="hljs-number">5</span>,<span class="hljs-string">'abc'</span>]
target.log().assert_Is(target)
log_Messages.assert_Is([<span class="hljs-string">'1,3,5,abc'</span>])</pre></div></div>
</li>
</ul>
</div>
</body>
</html>