File tree Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
var FileInfo = require ( './lib/fileinfo.js' ) ;
4
- var configs = require ( './lib/configs' ) ;
4
+ var configs = require ( './lib/configs.js ' ) ;
5
5
var formidable = require ( 'formidable' ) ;
6
6
var fs = require ( 'fs' ) ;
7
7
var path = require ( 'path' ) ;
@@ -10,7 +10,8 @@ module.exports = uploadService;
10
10
11
11
function uploadService ( opts ) {
12
12
var options = configs . apply ( opts ) ;
13
- var transporter = require ( './lib/transport/' + options . storage . type === 'local' ?'aws' :'local' ) ( options ) ;
13
+ var transporter = options . storage . type === 'local' ?require ( './lib/transport/local.js' ) :require ( './lib/transport/aws.js' ) ;
14
+
14
15
transporter = transporter ( options ) ;
15
16
16
17
var fileUploader = { } ;
Original file line number Diff line number Diff line change 1
- var checkExists = require ( './checkFolder' ) ;
2
- /**
3
- * default configurations
4
- */
5
- module . exports = options ;
1
+ var checkExists = require ( './checkFolder.js' ) ;
2
+
6
3
var options = {
7
4
tmpDir : __dirname + '/tmp' ,
8
5
uploadDir : __dirname + '/public/files' ,
@@ -53,10 +50,6 @@ var options = {
53
50
54
51
this . validate ( ) ;
55
52
56
- delete this . apply ;
57
- delete this . specialApply ;
58
- delete this . validate ( ) ;
59
-
60
53
return this ;
61
54
62
55
} ,
@@ -122,3 +115,8 @@ var options = {
122
115
123
116
}
124
117
} ;
118
+
119
+ /*
120
+ * default configurations
121
+ */
122
+ module . exports = options ;
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
-
3
2
describe ( 'FileInfo package' , function ( ) {
4
3
var FileInfo = require ( '../lib/fileinfo.js' ) ;
5
4
// TODO - FileInfo default constructor or mock parameters
@@ -25,6 +24,11 @@ describe('Uploader configuration', function() {
25
24
// TODO - Create a mock object for the filesystem
26
25
uploader = require ( '../index' ) ;
27
26
} ) ;
27
+
28
+ it ( 'can require configs without error' , function ( ) {
29
+ var configs = require ( '../lib/configs.js' ) ;
30
+ expect ( configs ) . not . toBe ( null ) ;
31
+ } ) ;
28
32
29
33
it ( 'should have default config values' , function ( ) {
30
34
options = { } ;
You can’t perform that action at this time.
0 commit comments