@@ -38,7 +38,8 @@ describe('mirror', () => {
38
38
app = await mirror ( {
39
39
mirrorProtocol : 'http' ,
40
40
mirrorPort : 0 ,
41
- mirrorHost : '127.0.0.1'
41
+ mirrorHost : '127.0.0.1' ,
42
+ mirrorRegistry : 'http://127.0.0.1:1234'
42
43
} )
43
44
44
45
const content = 'manifest content'
@@ -54,7 +55,8 @@ describe('mirror', () => {
54
55
app = await mirror ( {
55
56
mirrorProtocol : 'http' ,
56
57
mirrorPort : 0 ,
57
- mirrorHost : '127.0.0.1'
58
+ mirrorHost : '127.0.0.1' ,
59
+ mirrorRegistry : 'http://127.0.0.1:1234'
58
60
} )
59
61
60
62
const content = 'tarball content'
@@ -140,4 +142,25 @@ describe('mirror', () => {
140
142
141
143
expect ( result . trim ( ) ) . to . equal ( data . trim ( ) )
142
144
} )
145
+
146
+ it ( 'should proxy all other requests to the registry' , async ( ) => {
147
+ let data = 'hello world'
148
+
149
+ const server = await createTestServer ( ( server ) => {
150
+ return {
151
+ '/-/user/org.couchdb.user:dave' : data
152
+ }
153
+ } )
154
+
155
+ app = await mirror ( {
156
+ mirrorProtocol : 'http' ,
157
+ mirrorPort : 0 ,
158
+ mirrorHost : '127.0.0.1' ,
159
+ mirrorRegistry : `http://127.0.0.1:${ server . address ( ) . port } `
160
+ } )
161
+
162
+ const result = await request . put ( `http://127.0.0.1:${ app . address ( ) . port } /-/user/org.couchdb.user:dave` )
163
+
164
+ expect ( result . trim ( ) ) . to . equal ( data . trim ( ) )
165
+ } )
143
166
} )
0 commit comments