diff --git a/gulpfile.js b/gulpfile.js index 71b03552..8bad99b3 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,8 +7,8 @@ concat = require('gulp-concat'), stylestats = require('gulp-stylestats'), mocha = require('gulp-mocha'), - - test = require('./test/test.js'), + + cloudfunc = require('./test/lib/cloudfunc.js'), Util = require('./lib/util'), fs = require('fs'), exec = require('child_process').exec, @@ -45,7 +45,7 @@ }); gulp.task('test', function() { - test.check(); + cloudfunc.check(); gulp.src('test/lib/util.js') .pipe(mocha({reporter: 'progress'})) diff --git a/test/expect.html b/test/expect.html deleted file mode 100644 index 73036fb6..00000000 --- a/test/expect.html +++ /dev/null @@ -1,25 +0,0 @@ -
- - name - size - owner - mode -
\ No newline at end of file diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 22253949..00000000 --- a/test/test.js +++ /dev/null @@ -1,87 +0,0 @@ -(function() { - 'use strict'; - - var DIR = process.cwd() + '/', - main = require(DIR + 'lib/server/main'), - - Util = main.util, - - CloudFunc = main.cloudfunc, - HTMLDIR = main.HTMLDIR, - files = main.files, - - FS_DIR = HTMLDIR + 'fs/', - TEMPLATEPATH = FS_DIR + 'file.html', - LINK_TEMPLATE_PATH = FS_DIR + 'link.html', - PATHTEMPLATE_PATH = FS_DIR + 'path.html', - EXPECT_PATH = DIR + 'test/expect.html', - - Files = [TEMPLATEPATH, PATHTEMPLATE_PATH, LINK_TEMPLATE_PATH, EXPECT_PATH], - - JSON_FILES = { - path : '/etc/X11/', - files : [{ - name: 'applnk', - size: 'dir', - uid : 0, - mode: '40755' - }, { - name: 'prefdm', - size: 1328, - uid : 0, - mode: '100755' - }] - }, - - - Expect = - '
' + - '' + - '' + - '' + - '' + - '/' + - '' + - 'etc' + - '/X11/' + - '' + - '
'; - - - exports.check = function() { - files.read(Files, 'utf-8', function(errors, files) { - var i, n, template, pathTemplate, linkTemplate, expect, result; - - if (errors) - Util.log(errors); - else { - Util.time('CloudFunc.buildFromJSON'); - - template = files[TEMPLATEPATH]; - pathTemplate = files[PATHTEMPLATE_PATH]; - linkTemplate = files[LINK_TEMPLATE_PATH]; - expect = files[EXPECT_PATH]; - - result = CloudFunc.buildFromJSON(JSON_FILES, template, pathTemplate, linkTemplate); - - Expect += expect; - - n = Expect.length; - for (i = 0; i < n; i++) - if (result[i] !== Expect[i]) { - Util.log('Error in char number: ' + i + '\n' + - 'Expect: ' + Expect.substr(i) + '\n' + - 'Result: ' + result.substr(i) ); - break; - } - - if (i === n) - console.log('CloudFunc.buildFromJSON: OK'); - - Util.timeEnd('CloudFunc.buildFromJSON'); - } - }); - }; -})();