UNPKG

fluentnode

Version:

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

76 lines (70 loc) 3.35 kB
// Generated by CoffeeScript 1.12.7 (function() { var expect, path; require('../../src/fluentnode'); expect = require('chai').expect; path = require('path'); describe('| node-native | path', function() { it('path_Combine', function() { expect("".path_Combine).to.be.an('function'); expect("".path_Combine()).to.be.an('string'); expect("".path_Combine()).to.equal(''); expect("abc".path_Combine()).to.equal('abc'); return expect("abc".path_Combine('def')).to.equal("abc" + path.sep + "def"); }); it('path_Combine , file_Parent_Folder', function() { ''.file_Dir_Name.assert_Is_Function(); '.'.fullPath().path_Combine('aaaa').file_Dir_Name().assert_Is(".".fullPath()); return '/abc/def/123.txt'.file_Parent_Folder().assert_Is('/abc/def'); }); it('append_To_Process_Cwd_Path', function() { expect("".append_To_Process_Cwd_Path).to.be.an('function'); expect("".append_To_Process_Cwd_Path()).to.equal(process.cwd()); expect("abc".append_To_Process_Cwd_Path()).to.equal(process.cwd() + (path.sep + "abc")); expect("abc.txt".append_To_Process_Cwd_Path()).to.equal(process.cwd() + (path.sep + "abc.txt")); return expect("abc/aaa.txt".append_To_Process_Cwd_Path()).to.equal(process.cwd() + (path.sep + "abc" + path.sep + "aaa.txt")); }); it('file_Extension', function() { expect("".file_Extension).to.be.an('function'); expect("".file_Extension()).to.be.an('string'); expect("index.html".file_Extension()).to.equal('.html'); expect("index.abc.html".file_Extension()).to.equal('.html'); expect("index.".file_Extension()).to.equal('.'); return expect("index".file_Extension()).to.equal(''); }); it('file_Name', function() { expect(''.file_Name).to.be.an('function'); expect(''.file_Name()).to.equal(''); expect('/a/b'.file_Name()).to.equal('b'); expect('/a/b/c'.file_Name()).to.equal('c'); return expect('/a/b.txt'.file_Name()).to.equal('b.txt'); }); it('file_Name_Without_Extension', function() { expect(''.file_Name_Without_Extension).to.be.an('function'); expect(''.file_Name_Without_Extension()).to.equal(''); expect('/a/b'.file_Name_Without_Extension()).to.equal('b'); expect('/a/b..c'.file_Name_Without_Extension()).to.equal('b.'); return expect('/a/b.txt'.file_Name_Without_Extension()).to.equal('b'); }); it('file_Names', function() { var result, source; source = ['/a/b', '/a/b/', '/a/b/c', '/a/d/f.txt']; result = ['b', 'b', 'c', 'f.txt']; expect(source.file_Names).to.be.an('function'); return expect(source.file_Names()).to.deep.equal(result); }); it('file_Names_Without_Extension', function() { var result, source; source = ['/a/b', '/a/b/', '/a/b/c', '/a/d/f.txt']; result = ['b', 'b', 'c', 'f']; expect(source.file_Names_Without_Extension).to.be.an('function'); return expect(source.file_Names_Without_Extension()).to.deep.equal(result); }); return it('folder_Name', function() { var temp_Dir; temp_Dir = '_temp_Dir_'.add_5_Letters().folder_Create(); temp_Dir.assert_Folder_Exists().folder_Name().assert_Contains('_temp_Dir_'); return temp_Dir.folder_Delete().assert_Is_True(); }); }); }).call(this);