Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mamboer committed Mar 13, 2015
1 parent 35a9be5 commit a9e711b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

var FileInfo = require('./lib/fileinfo.js');
var configs = require('./lib/configs');
var configs = require('./lib/configs.js');
var formidable = require('formidable');
var fs = require('fs');
var path = require('path');
Expand All @@ -10,7 +10,8 @@ module.exports = uploadService;

function uploadService(opts) {
var options = configs.apply(opts);
var transporter = require('./lib/transport/'+options.storage.type === 'local'?'aws':'local')(options);
var transporter = options.storage.type === 'local'?require('./lib/transport/local.js'):require('./lib/transport/aws.js');

transporter = transporter(options);

var fileUploader = {};
Expand Down
16 changes: 7 additions & 9 deletions lib/configs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
var checkExists = require('./checkFolder');
/**
* default configurations
*/
module.exports = options;
var checkExists = require('./checkFolder.js');

var options = {
tmpDir: __dirname + '/tmp',
uploadDir: __dirname + '/public/files',
Expand Down Expand Up @@ -53,10 +50,6 @@ var options = {

this.validate();

delete this.apply;
delete this.specialApply;
delete this.validate();

return this;

},
Expand Down Expand Up @@ -122,3 +115,8 @@ var options = {

}
};

/*
* default configurations
*/
module.exports = options;
6 changes: 5 additions & 1 deletion specs/fileupload-spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';

describe('FileInfo package', function() {
var FileInfo = require('../lib/fileinfo.js');
// TODO - FileInfo default constructor or mock parameters
Expand All @@ -25,6 +24,11 @@ describe('Uploader configuration', function() {
// TODO - Create a mock object for the filesystem
uploader = require('../index');
});

it('can require configs without error',function(){
var configs = require('../lib/configs.js');
expect(configs).not.toBe(null);
});

it('should have default config values', function() {
options = {};
Expand Down

0 comments on commit a9e711b

Please sign in to comment.