UNPKG

fluentnode

Version:

Fluent apis for node (based on the concepts used in C#'s FluentSharp

366 lines (241 loc) 14.8 kB
<!DOCTYPE html> <html> <head> <title>path.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 &hellip;</a> <a class="small" href="javascript:void(0);">+</a> <div id="jump_wrapper"> <div id="jump_page"> <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="fluentnode.html"> fluentnode.coffee </a> <a class="source" href="index.html"> index.md </a> <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="console.html"> console.litcoffee </a> <a class="source" href="crypto.html"> crypto.litcoffee </a> <a class="source" href="fs.html"> fs.litcoffee </a> <a class="source" href="http.GET.html"> http.GET.litcoffee </a> <a class="source" href="http.POST.html"> http.POST.litcoffee </a> <a class="source" href="http.Server.html"> http.Server.litcoffee </a> <a class="source" href="http.html"> http.litcoffee </a> <a class="source" href="path.html"> path.litcoffee </a> <a class="source" href="process.html"> process.litcoffee </a> <a class="source" href="encoding.html"> encoding.litcoffee </a> <a class="source" href="globals.html"> globals.litcoffee </a> <a class="source" href="assert_Array.test.html"> assert_Array.test.coffee </a> <a class="source" href="assert_Boolean.test.html"> assert_Boolean.test.coffee </a> <a class="source" href="assert_Function.test.html"> assert_Function.test.coffee </a> <a class="source" href="assert_Number.test.html"> assert_Number.test.coffee </a> <a class="source" href="assert_Object.test.html"> assert_Object.test.coffee </a> <a class="source" href="assert_String.test.html"> assert_String.test.coffee </a> <a class="source" href="fluentnode.test.html"> fluentnode.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="crypto.test.html"> crypto.test.coffee </a> <a class="source" href="fs.test.html"> fs.test.coffee </a> <a class="source" href="http.GET.test.html"> http.GET.test.coffee </a> <a class="source" href="http.POST.test.html"> http.POST.test.coffee </a> <a class="source" href="http.Server.test.html"> http.Server.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> <a class="source" href="encoding.test.html"> encoding.test.coffee </a> <a class="source" href="globals.test.html"> globals.test.coffee </a> </div> </li> </ul> <ul class="sections"> <li id="title"> <div class="annotation"> <h1>path.test.coffee</h1> </div> </li> <li id="section-1"> <div class="annotation"> <div class="pilwrap "> <a class="pilcrow" href="#section-1">&#182;</a> </div> </div> <div class="content"><div class='highlight'><pre> <span class="hljs-built_in">require</span>(<span class="hljs-string">'../../src/fluentnode'</span>) expect = <span class="hljs-built_in">require</span>(<span class="hljs-string">'chai'</span>).expect path = <span class="hljs-built_in">require</span>(<span class="hljs-string">'path'</span>) describe <span class="hljs-string">'| path'</span>,<span class="hljs-function">-&gt;</span> it <span class="hljs-string">'path_Combine'</span>, <span class="hljs-function">-&gt;</span> expect(<span class="hljs-string">""</span>.path_Combine ).to.be.an(<span class="hljs-string">'function'</span>) expect(<span class="hljs-string">""</span>.path_Combine()).to.be.an(<span class="hljs-string">'string'</span>) expect(<span class="hljs-string">""</span> .path_Combine()).to.equal(<span class="hljs-string">''</span>) expect(<span class="hljs-string">"abc"</span>.path_Combine()).to.equal(<span class="hljs-string">'abc'</span>) expect(<span class="hljs-string">"abc"</span>.path_Combine(<span class="hljs-string">'def'</span>)).to.equal(<span class="hljs-string">"abc<span class="hljs-subst">#{path.sep}</span>def"</span>) it <span class="hljs-string">'path_Combine , file_Parent_Folder'</span>, <span class="hljs-function">-&gt;</span> <span class="hljs-string">''</span>.file_Dir_Name.assert_Is_Function() <span class="hljs-string">'.'</span>.fullPath().path_Combine(<span class="hljs-string">'aaaa'</span>) .file_Dir_Name().assert_Is(<span class="hljs-string">"."</span>.fullPath()) <span class="hljs-string">'/abc/def/123.txt'</span>.file_Parent_Folder().assert_Is(<span class="hljs-string">'/abc/def'</span>) it <span class="hljs-string">'append_To_Process_Cwd_Path'</span>, <span class="hljs-function">-&gt;</span> expect(<span class="hljs-string">""</span> .append_To_Process_Cwd_Path ).to.be.an(<span class="hljs-string">'function'</span>) expect(<span class="hljs-string">""</span> .append_To_Process_Cwd_Path()).to.equal(process.cwd()) expect(<span class="hljs-string">"abc"</span> .append_To_Process_Cwd_Path()).to.equal(process.cwd() + <span class="hljs-string">"<span class="hljs-subst">#{path.sep}</span>abc"</span> ) expect(<span class="hljs-string">"abc.txt"</span> .append_To_Process_Cwd_Path()).to.equal(process.cwd() + <span class="hljs-string">"<span class="hljs-subst">#{path.sep}</span>abc.txt"</span> ) expect(<span class="hljs-string">"abc/aaa.txt"</span>.append_To_Process_Cwd_Path()).to.equal(process.cwd() + <span class="hljs-string">"<span class="hljs-subst">#{path.sep}</span>abc<span class="hljs-subst">#{path.sep}</span>aaa.txt"</span>) it <span class="hljs-string">'file_Extension'</span>, <span class="hljs-function">-&gt;</span> expect(<span class="hljs-string">""</span>.file_Extension ).to.be.an(<span class="hljs-string">'function'</span>) expect(<span class="hljs-string">""</span>.file_Extension()).to.be.an(<span class="hljs-string">'string'</span>) expect(<span class="hljs-string">"index.html"</span> .file_Extension()).to.equal(<span class="hljs-string">'.html'</span>) expect(<span class="hljs-string">"index.abc.html"</span>.file_Extension()).to.equal(<span class="hljs-string">'.html'</span>) expect(<span class="hljs-string">"index."</span> .file_Extension()).to.equal(<span class="hljs-string">'.'</span>) expect(<span class="hljs-string">"index"</span> .file_Extension()).to.equal(<span class="hljs-string">''</span>) it <span class="hljs-string">'file_Name'</span>, <span class="hljs-function">-&gt;</span> expect(<span class="hljs-string">''</span> .file_Name ).to.be.an(<span class="hljs-string">'function'</span>) expect(<span class="hljs-string">''</span> .file_Name()).to.equal(<span class="hljs-string">''</span>) expect(<span class="hljs-string">'/a/b'</span> .file_Name()).to.equal(<span class="hljs-string">'b'</span>) expect(<span class="hljs-string">'/a/b/c'</span> .file_Name()).to.equal(<span class="hljs-string">'c'</span>) expect(<span class="hljs-string">'/a/b.txt'</span>.file_Name()).to.equal(<span class="hljs-string">'b.txt'</span>) it <span class="hljs-string">'file_Name_Without_Extension'</span>, <span class="hljs-function">-&gt;</span> expect(<span class="hljs-string">''</span> .file_Name_Without_Extension ).to.be.an(<span class="hljs-string">'function'</span>) expect(<span class="hljs-string">''</span> .file_Name_Without_Extension()).to.equal(<span class="hljs-string">''</span> ) expect(<span class="hljs-string">'/a/b'</span> .file_Name_Without_Extension()).to.equal(<span class="hljs-string">'b'</span> ) expect(<span class="hljs-string">'/a/b..c'</span> .file_Name_Without_Extension()).to.equal(<span class="hljs-string">'b.'</span>) expect(<span class="hljs-string">'/a/b.txt'</span>.file_Name_Without_Extension()).to.equal(<span class="hljs-string">'b'</span> ) it <span class="hljs-string">'file_Names'</span>, <span class="hljs-function">-&gt;</span> source = [<span class="hljs-string">'/a/b'</span>,<span class="hljs-string">'/a/b/'</span>, <span class="hljs-string">'/a/b/c'</span>, <span class="hljs-string">'/a/d/f.txt'</span>] result = [<span class="hljs-string">'b'</span> ,<span class="hljs-string">'b'</span> , <span class="hljs-string">'c'</span> , <span class="hljs-string">'f.txt'</span> ] expect(source.file_Names ).to.be.an(<span class="hljs-string">'function'</span>) expect(source.file_Names()).to.deep.equal(result) it <span class="hljs-string">'file_Names_Without_Extension'</span>, <span class="hljs-function">-&gt;</span> source = [<span class="hljs-string">'/a/b'</span>,<span class="hljs-string">'/a/b/'</span>, <span class="hljs-string">'/a/b/c'</span>, <span class="hljs-string">'/a/d/f.txt'</span>] result = [<span class="hljs-string">'b'</span> ,<span class="hljs-string">'b'</span> , <span class="hljs-string">'c'</span> , <span class="hljs-string">'f'</span> ] expect(source.file_Names_Without_Extension ).to.be.an(<span class="hljs-string">'function'</span>) expect(source.file_Names_Without_Extension()).to.deep.equal(result) it <span class="hljs-string">'folder_Name'</span>, <span class="hljs-function">-&gt;</span> temp_Dir = <span class="hljs-string">'_temp_Dir_'</span>.add_5_Letters().folder_Create() temp_Dir.assert_Folder_Exists() .folder_Name() .assert_Contains <span class="hljs-string">'_temp_Dir_'</span> temp_Dir.folder_Delete().assert_Is_True()</pre></div></div> </li> </ul> </div> </body> </html>