feature(package) mocha -> tape

This commit is contained in:
coderaiser 2016-02-22 06:01:31 -05:00
parent 2248ec193f
commit 8ef751f06f
7 changed files with 49 additions and 41 deletions

View file

@ -2,24 +2,28 @@
<span data-name="js-type" class="mini-icon "></span>
<span data-name="js-name" class="name reduce-text">name</span>
<span data-name="js-size" class="size reduce-text">size</span>
<span data-name="js-date" class="date reduce-text">date</span>
<span data-name="js-owner" class="owner reduce-text">owner</span>
<span data-name="js-mode" class="mode reduce-text">mode</span>
</div><ul data-name="js-files" class="files"><li draggable="true" data-name="js-file-.." class="">
<span data-name="js-type" class="mini-icon directory"></span>
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc" title=".." draggable="true">..</a></span>
<span data-name="js-size" class="size reduce-text">&lt;dir&gt;</span>
<span data-name="js-date" class="date reduce-text">--.--.----</span>
<span data-name="js-owner" class="owner reduce-text">.</span>
<span data-name="js-mode" class="mode reduce-text">--- --- ---</span>
</li><li draggable="true" data-name="js-file-applnk" class="">
<span data-name="js-type" class="mini-icon directory"></span>
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc/X11/applnk" title="applnk" draggable="true">applnk</a></span>
<span data-name="js-size" class="size reduce-text">&lt;dir&gt;</span>
<span data-name="js-date" class="date reduce-text">21.02.2016</span>
<span data-name="js-owner" class="owner reduce-text">root</span>
<span data-name="js-mode" class="mode reduce-text">rwx r-x r-x</span>
</li><li draggable="true" data-name="js-file-prefdm" class="">
<span data-name="js-type" class="mini-icon text-file"></span>
<span data-name="js-name" class="name reduce-text"><a href="/fs/etc/X11/prefdm" title="prefdm" target="_blank" draggable="true">prefdm</a></span>
<span data-name="js-size" class="size reduce-text">1.30kb</span>
<span data-name="js-date" class="date reduce-text">21.02.2016</span>
<span data-name="js-owner" class="owner reduce-text">root</span>
<span data-name="js-mode" class="mode reduce-text">rwx r-x r-x</span>
</li></ul>

View file

@ -1,8 +1,6 @@
(function() {
'use strict';
/* global describe, it */
var DIR = __dirname + '/../../',
LIBDIR = DIR + 'lib/',
TMPLDIR = DIR + 'tmpl/',
@ -12,6 +10,8 @@
files = require('files-io'),
rendy = require('rendy'),
test = require('tape'),
FS_DIR = TMPLDIR + 'fs/',
EXPECT_PATH = DIR + 'test/lib/cloudfunc.html',
@ -27,11 +27,13 @@
files : [{
name: 'applnk',
size: 'dir',
date: '21.02.2016',
uid : 0,
mode: 'rwx r-x r-x'
}, {
name: 'prefdm',
size: '1.30kb',
date: '21.02.2016',
uid : 0,
mode: 'rwx r-x r-x'
}]
@ -51,15 +53,9 @@
'</a>/X11/' +
'</span>' +
'</div>';
describe('cloudfunc', function() {
it('should check', function() {
check();
});
});
function check() {
var paths = {},
test(function(t) {
var paths = {},
filesList = TMPL_PATH.map(function(name) {
var path = FS_DIR + name + '.hbs';
@ -119,9 +115,14 @@
result: result.substr(i)
}));
throw('buildFromJSON: Not OK');
console.log('buildFromJSON: Not OK');
}
t.equal(Expect, result, 'should be equal rendered json data');
t.end();
}
});
}
});
})();

View file

@ -1,30 +1,27 @@
(function() {
'use strict';
/*global describe, it */
var should = require('should'),
var test = require('tape'),
DIR = '../../',
Util = require(DIR + 'lib/util');
describe('Util', function() {
describe('getExt', function() {
it('should return "" when extension is none', function() {
var EXT = '',
name = 'file-withot-extension',
ext = Util.getExt(name);
should(ext).eql(EXT);
});
it('should return ".png" in files "picture.png"', function() {
var EXT = '.png',
name = 'picture.png',
ext = Util.getExt(name);
should(ext).eql(EXT);
});
});
test('getExt: no extension', function(t) {
var EXT = '',
name = 'file-withot-extension',
ext = Util.getExt(name);
t.equal(ext, EXT, 'should return "" when extension is none');
t.end();
});
test('getExt: return extension', function(t) {
var EXT = '.png',
name = 'picture.png',
ext = Util.getExt(name);
t.equal(ext, EXT, 'should return ".png" in files "picture.png"');
t.end();
});
})();