File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -195,3 +195,36 @@ routes.forEach(route => {
195
195
} ) ;
196
196
} ) ;
197
197
} )
198
+
199
+ describe ( `app with unspupported version` , ( ) => {
200
+ beforeEach ( ( ) => {
201
+ db . query = ( ) => Promise . resolve ( ) ;
202
+ } ) ;
203
+
204
+ it ( 'should not accept unsupported versions' , done => {
205
+ db . query = ( params ) => {
206
+ expect ( params . reportAgency ) . to . equal ( 'fake-agency' ) ;
207
+ expect ( params . reportName ) . to . equal ( 'fake-report' ) ;
208
+ const arr = handleIfRouteNotice ( route , [
209
+ { id : 1 , date : new Date ( '2017-01-01' ) } ,
210
+ { id : 2 , date : new Date ( '2017-01-02' ) }
211
+ ] )
212
+ return Promise . resolve ( arr )
213
+ } ;
214
+
215
+ const unspupportedVersion = 'v2.x'
216
+ const expectedErrorMessage = 'Version not found. Visit https://analytics.usa.gov/developer for information on the latest supported version.' ;
217
+
218
+ const dataRequest = request ( app )
219
+ . get ( `/${ unspupportedVersion } /agencies/fake-agency/reports/fake-report/data` )
220
+ . expect ( 404 ) ;
221
+
222
+ dataRequest . then ( response => {
223
+ expect ( response ) . to . include ( {
224
+ _body : expectedErrorMessage ,
225
+ status : 404
226
+ } ) ;
227
+ done ( ) ;
228
+ } ) . catch ( done ) ;
229
+ } ) ;
230
+ } ) ;
You can’t perform that action at this time.
0 commit comments