11const debug = require ( 'debug' ) ( 'test:deprecated' ) ;
22const { expect } = require ( 'chai' ) ;
3+ const config = require ( 'config' ) ;
34const path = require ( 'path' ) ;
45const replay = require ( 'replay' ) ;
56const supertest = require ( 'supertest' ) ;
67// eslint-disable-next-line global-require
78const authWebService = process . env . URL || require ( '../../auth_service' ) ;
89
10+ const REPLAY = process . env . REPLAY || '' ;
11+
912// eslint-disable-next-line no-underscore-dangle
1013const originalLocalhosts = replay . _localhosts ;
1114const requestId = 'deprecated-spec' ;
1215replay . fixtures = path . join ( __dirname , '/../fixtures/replay' ) ;
16+ let couchDBInfo ;
1317
1418describe ( '/ deprecated' , ( ) => {
1519 const testUsername = process . env . REPLAY ? `test${ Date . now ( ) } ` : 'test1637710294972' ;
@@ -19,6 +23,16 @@ describe('/ deprecated', () => {
1923 replay . _localhosts = new Set ( [ '127.0.0.1' , '::1' ] ) ;
2024 // eslint-disable-next-line no-underscore-dangle
2125 debug ( 'before replay localhosts' , replay . _localhosts ) ;
26+
27+ return supertest ( config . usersDbConnection . url )
28+ . get ( '/' )
29+ . set ( 'Accept' , 'application/json' )
30+ . then ( ( res ) => {
31+ expect ( res . status ) . to . equal ( 200 ) ;
32+ debug ( 'couchdb version' , res . body ) ;
33+ couchDBInfo = res . body ;
34+ expect ( couchDBInfo . version ) . to . be . a ( 'string' , JSON . stringify ( couchDBInfo ) ) ;
35+ } ) ;
2236 } ) ;
2337 after ( ( ) => {
2438 // eslint-disable-next-line no-underscore-dangle
@@ -84,7 +98,8 @@ describe('/ deprecated', () => {
8498 ] ,
8599 } ,
86100 info : {
87- authentication_handlers : [ 'cookie' , 'default' ] ,
101+ authentication_db : couchDBInfo . version = '1.6.1' ? '_users' : undefined ,
102+ authentication_handlers : couchDBInfo . version = '1.6.1' ? [ 'oauth' , 'cookie' , 'default' ] : [ 'cookie' , 'default' ] ,
88103 authenticated : 'default' ,
89104 } ,
90105 } , 'should have roles' ) ;
0 commit comments