@@ -32,7 +32,7 @@ describe("Server", function() {
32
32
var instance = middleware ( compiler , {
33
33
stats : "errors-only" ,
34
34
quiet : true ,
35
- publicPath : "/" ,
35
+ publicPath : "/public/ " ,
36
36
} ) ;
37
37
app . use ( instance ) ;
38
38
listen = listenShorthand ( done ) ;
@@ -42,59 +42,65 @@ describe("Server", function() {
42
42
after ( close ) ;
43
43
44
44
it ( "GET request to bundle file" , function ( done ) {
45
- request ( app ) . get ( "/bundle.js" )
45
+ request ( app ) . get ( "/public/ bundle.js" )
46
46
. expect ( "Content-Type" , "application/javascript" )
47
47
. expect ( "Content-Length" , "2780" )
48
48
. expect ( "Access-Control-Allow-Origin" , "*" )
49
49
. expect ( 200 , / c o n s o l e \. l o g \( " H e y \. " \) / , done ) ;
50
50
} ) ;
51
51
52
52
it ( "POST request to bundle file" , function ( done ) {
53
- request ( app ) . post ( "/bundle.js" )
53
+ request ( app ) . post ( "/public/ bundle.js" )
54
54
. expect ( 404 , done ) ;
55
55
} ) ;
56
56
57
57
it ( "request to image" , function ( done ) {
58
- request ( app ) . get ( "/svg.svg" )
58
+ request ( app ) . get ( "/public/ svg.svg" )
59
59
. expect ( "Content-Type" , "image/svg+xml" )
60
60
. expect ( "Content-Length" , "4778" )
61
61
. expect ( "Access-Control-Allow-Origin" , "*" )
62
62
. expect ( 200 , done ) ;
63
63
} ) ;
64
64
65
65
it ( "request to non existing file" , function ( done ) {
66
- request ( app ) . get ( "/nope" )
66
+ request ( app ) . get ( "/public/ nope" )
67
67
. expect ( "Content-Type" , "text/html; charset=utf-8" )
68
68
. expect ( 404 , done ) ;
69
69
} ) ;
70
70
71
71
it ( "request to HMR json" , function ( done ) {
72
- request ( app ) . get ( "/123a123412.hot-update.json" )
72
+ request ( app ) . get ( "/public/ 123a123412.hot-update.json" )
73
73
. expect ( "Content-Type" , "application/json" )
74
74
. expect ( 200 , / \[ \" h i \" \] / , done ) ;
75
75
} ) ;
76
76
77
77
it ( "request to directory" , function ( done ) {
78
- request ( app ) . get ( "/" )
78
+ request ( app ) . get ( "/public/ " )
79
79
. expect ( "Content-Type" , "text/html" )
80
80
. expect ( "Content-Length" , "10" )
81
81
. expect ( "Access-Control-Allow-Origin" , "*" )
82
82
. expect ( 200 , / M y \ I n d e x \. / , done ) ;
83
83
} ) ;
84
84
85
85
it ( "invalid range header" , function ( done ) {
86
- request ( app ) . get ( "/svg.svg" )
86
+ request ( app ) . get ( "/public/ svg.svg" )
87
87
. set ( "Range" , "bytes=6000-" )
88
88
. expect ( 416 , done ) ;
89
89
} ) ;
90
90
91
91
it ( "valid range header" , function ( done ) {
92
- request ( app ) . get ( "/svg.svg" )
92
+ request ( app ) . get ( "/public/ svg.svg" )
93
93
. set ( "Range" , "bytes=3000-3500" )
94
94
. expect ( "Content-Length" , "501" )
95
95
. expect ( "Content-Range" , "bytes 3000-3500/4778" )
96
96
. expect ( 206 , done ) ;
97
97
} ) ;
98
+
99
+ it ( "request to non-public path" , function ( done ) {
100
+ request ( app ) . get ( "/nonpublic/" )
101
+ . expect ( "Content-Type" , "text/html; charset=utf-8" )
102
+ . expect ( 404 , done ) ;
103
+ } ) ;
98
104
} ) ;
99
105
100
106
describe ( "lazy mode" , function ( ) {
0 commit comments