From 51de574c71d3896dd5ce55986d59f98b04d63c7d Mon Sep 17 00:00:00 2001 From: Herwindo Artono Date: Wed, 6 Jun 2018 17:10:19 +0700 Subject: [PATCH] check string pattern in data before parsed --- lib/aws.js | 12 +++++++++++- test/checkStringIsXML.js | 15 +++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/checkStringIsXML.js diff --git a/lib/aws.js b/lib/aws.js index ee28416..fa0ddbe 100644 --- a/lib/aws.js +++ b/lib/aws.js @@ -38,6 +38,12 @@ exports.createCFNClient = cfn.init(genericAWSClient); exports.createEMRClient = emr.init(genericAWSClient); exports.createMetaDataClient = metadata.init(); +function checkStringIsXML(data) { + var matcher = new RegExp(''; +otherStringPattern = '' + +describe('checkStringXML fn', function () { + it('should return true for string with xml patterns', function () { + console.log('testing check string is XML'); + assert.equal(checkStringIsXML(xmlStringPattern), true); + }); + it('should return false for string with other than xml pattern', function () { + assert.equal(checkStringIsXML(otherStringPattern), false); + }); +}); \ No newline at end of file