@@ -20,8 +20,8 @@ describe('Endpoints', function () {
2020
2121 describe ( 'Check version' , ( ) => {
2222 it ( '[Check-Version-0001] Should return version issue for Filebeat' , ( ) => {
23- const filebeatVersion = 1 ;
24- const logstashVersion = 1 ;
23+ const filebeatVersion = "1" ;
24+ const logstashVersion = "1" ;
2525 return requestAsync ( {
2626 method : 'GET' ,
2727 uri : `http://localhost:${ server . apibuilder . port } /api/elk/v1/api/version/check?filebeatVersion=${ filebeatVersion } &logstashVersion=${ logstashVersion } ` ,
@@ -34,8 +34,8 @@ describe('Endpoints', function () {
3434 } ) ;
3535
3636 it ( '[Check-Version-0002] Should return version issue for Filebeat' , ( ) => {
37- const filebeatVersion = 2 ;
38- const logstashVersion = 1 ;
37+ const filebeatVersion = "2" ;
38+ const logstashVersion = "1" ;
3939 return requestAsync ( {
4040 method : 'GET' ,
4141 uri : `http://localhost:${ server . apibuilder . port } /api/elk/v1/api/version/check?filebeatVersion=${ filebeatVersion } &logstashVersion=${ logstashVersion } ` ,
@@ -48,8 +48,8 @@ describe('Endpoints', function () {
4848 } ) ;
4949
5050 it ( '[Check-Version-0003] Should return version check ok' , ( ) => {
51- const filebeatVersion = 2 ;
52- const logstashVersion = 2 ;
51+ const filebeatVersion = "2" ;
52+ const logstashVersion = "2" ;
5353 return requestAsync ( {
5454 method : 'GET' ,
5555 uri : `http://localhost:${ server . apibuilder . port } /api/elk/v1/api/version/check?filebeatVersion=${ filebeatVersion } &logstashVersion=${ logstashVersion } ` ,
@@ -61,13 +61,29 @@ describe('Endpoints', function () {
6161 } ) ;
6262 } ) ;
6363
64- it ( '[Check-Version-0004] Should return 400 if parameters are missing' , ( ) => {
64+ it ( '[Check-Version-0004] Should return 200 with an error status if parameters are missing' , ( ) => {
6565 return requestAsync ( {
6666 method : 'GET' ,
6767 uri : `http://localhost:${ server . apibuilder . port } /api/elk/v1/api/version/check` ,
6868 json : true
6969 } ) . then ( ( { response, body } ) => {
70- expect ( response . statusCode ) . to . equal ( 400 ) ;
70+ expect ( response . statusCode ) . to . equal ( 200 ) ;
71+ expect ( body . message ) . to . equal ( `Filebeat version does not match to API-Builder release` ) ;
72+ expect ( body . versionStatus ) . to . equal ( `error` ) ;
73+ } ) ;
74+ } ) ;
75+
76+ it ( '[Check-Version-0005] Should return with an error status wit invalid versions' , ( ) => {
77+ const filebeatVersion = "something" ;
78+ const logstashVersion = "wrong" ;
79+ return requestAsync ( {
80+ method : 'GET' ,
81+ uri : `http://localhost:${ server . apibuilder . port } /api/elk/v1/api/version/check?filebeatVersion=${ filebeatVersion } &logstashVersion=${ logstashVersion } ` ,
82+ json : true
83+ } ) . then ( ( { response, body } ) => {
84+ expect ( response . statusCode ) . to . equal ( 200 ) ;
85+ expect ( body . message ) . to . equal ( `Filebeat version does not match to API-Builder release` ) ;
86+ expect ( body . versionStatus ) . to . equal ( `error` ) ;
7187 } ) ;
7288 } ) ;
7389 } ) ;
0 commit comments