@@ -40,7 +40,7 @@ describe('router unit test', () => {
4040 expect ( request . url ) . toBe ( '/' ) ;
4141 } ) ;
4242 it ( 'should return new target' , ( ) => {
43- expect ( result ) . resolves . toBe ( 'http://foobar.com:666' ) ;
43+ return expect ( result ) . resolves . toBe ( 'http://foobar.com:666' ) ;
4444 } ) ;
4545 } ) ;
4646 } ) ;
@@ -66,7 +66,7 @@ describe('router unit test', () => {
6666 expect ( request . url ) . toBe ( '/' ) ;
6767 } ) ;
6868 it ( 'should return new target' , ( ) => {
69- expect ( result ) . resolves . toBe ( 'http://foobar.com:666' ) ;
69+ return expect ( result ) . resolves . toBe ( 'http://foobar.com:666' ) ;
7070 } ) ;
7171 } ) ;
7272 } ) ;
@@ -90,71 +90,71 @@ describe('router unit test', () => {
9090 describe ( 'without router config' , ( ) => {
9191 it ( 'should return the normal target when router not present in config' , ( ) => {
9292 result = getTarget ( fakeReq , config ) ;
93- expect ( result ) . resolves . toBeUndefined ( ) ;
93+ return expect ( result ) . resolves . toBeUndefined ( ) ;
9494 } ) ;
9595 } ) ;
9696
9797 describe ( 'with just the host in router config' , ( ) => {
9898 it ( 'should target http://localhost:6001 when for router:"alpha.localhost"' , ( ) => {
9999 fakeReq . headers . host = 'alpha.localhost' ;
100100 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
101- expect ( result ) . resolves . toBe ( 'http://localhost:6001' ) ;
101+ return expect ( result ) . resolves . toBe ( 'http://localhost:6001' ) ;
102102 } ) ;
103103
104104 it ( 'should target http://localhost:6002 when for router:"beta.localhost"' , ( ) => {
105105 fakeReq . headers . host = 'beta.localhost' ;
106106 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
107- expect ( result ) . resolves . toBe ( 'http://localhost:6002' ) ;
107+ return expect ( result ) . resolves . toBe ( 'http://localhost:6002' ) ;
108108 } ) ;
109109 } ) ;
110110
111111 describe ( 'with host and host + path config' , ( ) => {
112112 it ( 'should target http://localhost:6004 without path' , ( ) => {
113113 fakeReq . headers . host = 'gamma.localhost' ;
114114 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
115- expect ( result ) . resolves . toBe ( 'http://localhost:6004' ) ;
115+ return expect ( result ) . resolves . toBe ( 'http://localhost:6004' ) ;
116116 } ) ;
117117
118118 it ( 'should target http://localhost:6003 exact path match' , ( ) => {
119119 fakeReq . headers . host = 'gamma.localhost' ;
120120 fakeReq . url = '/api' ;
121121 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
122- expect ( result ) . resolves . toBe ( 'http://localhost:6003' ) ;
122+ return expect ( result ) . resolves . toBe ( 'http://localhost:6003' ) ;
123123 } ) ;
124124
125125 it ( 'should target http://localhost:6004 when contains path' , ( ) => {
126126 fakeReq . headers . host = 'gamma.localhost' ;
127127 fakeReq . url = '/api/books/123' ;
128128 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
129- expect ( result ) . resolves . toBe ( 'http://localhost:6003' ) ;
129+ return expect ( result ) . resolves . toBe ( 'http://localhost:6003' ) ;
130130 } ) ;
131131 } ) ;
132132
133133 describe ( 'with just the path' , ( ) => {
134134 it ( 'should target http://localhost:6005 with just a path as router config' , ( ) => {
135135 fakeReq . url = '/rest' ;
136136 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
137- expect ( result ) . resolves . toBe ( 'http://localhost:6005' ) ;
137+ return expect ( result ) . resolves . toBe ( 'http://localhost:6005' ) ;
138138 } ) ;
139139
140140 it ( 'should target http://localhost:6005 with just a path as router config' , ( ) => {
141141 fakeReq . url = '/rest/deep/path' ;
142142 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
143- expect ( result ) . resolves . toBe ( 'http://localhost:6005' ) ;
143+ return expect ( result ) . resolves . toBe ( 'http://localhost:6005' ) ;
144144 } ) ;
145145
146146 it ( 'should target http://localhost:6000 path in not present in router config' , ( ) => {
147147 fakeReq . url = '/unknow-path' ;
148148 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
149- expect ( result ) . resolves . toBeUndefined ( ) ;
149+ return expect ( result ) . resolves . toBeUndefined ( ) ;
150150 } ) ;
151151 } ) ;
152152
153153 describe ( 'matching order of router config' , ( ) => {
154154 it ( 'should return first matching target when similar paths are configured' , ( ) => {
155155 fakeReq . url = '/some/specific/path' ;
156156 result = getTarget ( fakeReq , proxyOptionWithRouter ) ;
157- expect ( result ) . resolves . toBe ( 'http://localhost:6006' ) ;
157+ return expect ( result ) . resolves . toBe ( 'http://localhost:6006' ) ;
158158 } ) ;
159159 } ) ;
160160 } ) ;
0 commit comments