Produced by Araxis Merge on 10/3/2017 11:16:04 AM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\utils\error-processing | error-processing-api-spec.js | Mon Jul 10 17:46:22 2017 UTC |
| 2 | ehmp.zip\ehmp\ehmp\product\production\vx-sync\tests\unittests\utils\error-processing | error-processing-api-spec.js | Tue Oct 3 13:23:19 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 620 |
| Changed | 1 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | 'use stric t'; | |
| 2 | ||
| 3 | require('. ./../../.. /env-setup '); | |
| 4 | ||
| 5 | var logger = require (global.VX _DUMMIES + 'dummy-lo gger'); | |
| 6 | // NOTE: b e sure nex t line is commented out before pushing | |
| 7 | // log = r equire('bu nyan').cre ateLogger( { | |
| 8 | // nam e: 'poller -utils-spe c', | |
| 9 | // lev el: 'debug ' | |
| 10 | // }); | |
| 11 | ||
| 12 | var errorP rocessingA pi = requi re(global. VX_UTILS + 'error-pr ocessing/e rror-proce ssing-api' ); | |
| 13 | var JdsCli entDummy = require(g lobal.VX_D UMMIES + ' jds-client -dummy'); | |
| 14 | ||
| 15 | var enviro nment = { publisherR outer: { | |
| 16 | publis h: functio n(jobsToPu blish, han dlerCallba ck) { | |
| 17 | ha ndlerCallb ack(null, jobsToPubl ish); | |
| 18 | } | |
| 19 | }}; | |
| 20 | ||
| 21 | var config = { | |
| 22 | jds: { | |
| 23 | pr otocol: 'h ttp', | |
| 24 | host: ' IP ', | |
| 25 | port: PORT | |
| 26 | } | |
| 27 | }; | |
| 28 | ||
| 29 | describe(' error-proc essing-api ', functio n() { | |
| 30 | descri be('ErrorP rocessingC ontext', f unction() { | |
| 31 | be foreEach(f unction() { | |
| 32 | environm ent.jds = new JdsCli entDummy(l ogger, con fig); | |
| 33 | }) ; | |
| 34 | ||
| 35 | it ('constrai nts undefi ned define d', functi on() { | |
| 36 | var cont ext = erro rProcessin gApi.Error Processing Context(lo gger, conf ig, enviro nment); | |
| 37 | expect(c ontext.ign oreRetry). toBeFalsy( ); | |
| 38 | expect(c ontext.del eteOnly).t oBeFalsy() ; | |
| 39 | expect(c ontext.kee pRecord).t oBeFalsy() ; | |
| 40 | ||
| 41 | context = errorPro cessingApi .ErrorProc essingCont ext(logger , config, environmen t, {}); | |
| 42 | expect(c ontext.ign oreRetry). toBeFalsy( ); | |
| 43 | expect(c ontext.del eteOnly).t oBeFalsy() ; | |
| 44 | expect(c ontext.kee pRecord).t oBeFalsy() ; | |
| 45 | }) ; | |
| 46 | ||
| 47 | it ('all cons traints de fined', fu nction() { | |
| 48 | var cons traints = { | |
| 49 | 'ign ore-retry' : true, | |
| 50 | 'del ete-only': true, | |
| 51 | 'kee p-record': true, | |
| 52 | inde x: 'index- x', | |
| 53 | rang e: 'x>y>z' , | |
| 54 | filt er: 'eq(so urce,"z")' , | |
| 55 | limi t: '100' | |
| 56 | }; | |
| 57 | ||
| 58 | var cont ext = erro rProcessin gApi.Error Processing Context(lo gger, conf ig, enviro nment, con straints); | |
| 59 | expect(c ontext.ign oreRetry). toBeTruthy (); | |
| 60 | expect(c ontext.del eteOnly).t oBeTruthy( ); | |
| 61 | expect(c ontext.kee pRecord).t oBeTruthy( ); | |
| 62 | expect(c ontext.que ry).toBeTr uthy(); | |
| 63 | expect(c ontext.que ry.index). toBe('inde x-x'); | |
| 64 | expect(c ontext.que ry.range). toBe('x>y> z'); | |
| 65 | expect(c ontext.que ry.filter) .toBe('eq( source,"z" )'); | |
| 66 | expect(c ontext.que ry.limit). toBe('100' ); | |
| 67 | }) ; | |
| 68 | }); | |
| 69 | ||
| 70 | descri be('fetchE rrors', fu nction() { | |
| 71 | va r context, called; | |
| 72 | ||
| 73 | be foreEach(f unction() { | |
| 74 | environm ent.jds = new JdsCli entDummy(l ogger, con fig); | |
| 75 | context = errorPro cessingApi .ErrorProc essingCont ext(logger , config, environmen t, {}); | |
| 76 | ||
| 77 | called = false; | |
| 78 | }) ; | |
| 79 | ||
| 80 | it ('error th rown', fun ction() { | |
| 81 | environm ent.jds._s etResponse Data(['Con nection Er ror'], [nu ll], null) ; | |
| 82 | ||
| 83 | runs(fun ction() { | |
| 84 | erro rProcessin gApi.fetch Errors(con text, func tion(error , results) { | |
| 85 | expect(err or).toBeTr uthy(); | |
| 86 | expect(res ults).toBe Falsy(); | |
| 87 | ||
| 88 | called = t rue; | |
| 89 | }); | |
| 90 | }); | |
| 91 | ||
| 92 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 93 | }) ; | |
| 94 | ||
| 95 | it ('jds resp onse has e rror', fun ction() { | |
| 96 | environm ent.jds._s etResponse Data([null ], [{statu sCode: 500 }], {error : 'error'} ); | |
| 97 | ||
| 98 | runs(fun ction() { | |
| 99 | erro rProcessin gApi.fetch Errors(con text, func tion(error , results) { | |
| 100 | expect(err or).toBeTr uthy(); | |
| 101 | expect(res ults).toBe Falsy(); | |
| 102 | ||
| 103 | called = t rue; | |
| 104 | }); | |
| 105 | }); | |
| 106 | ||
| 107 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 108 | }) ; | |
| 109 | ||
| 110 | it ('successf ul fetch', function( ) { | |
| 111 | environm ent.jds._s etResponse Data([null ], [{statu sCode: 200 }], {items : []}); | |
| 112 | ||
| 113 | runs(fun ction() { | |
| 114 | erro rProcessin gApi.fetch Errors(con text, func tion(error , results) { | |
| 115 | expect(err or).toBeFa lsy(); | |
| 116 | expect(res ults.items ).toBeDefi ned(); | |
| 117 | ||
| 118 | called = t rue; | |
| 119 | }); | |
| 120 | }); | |
| 121 | ||
| 122 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 123 | }) ; | |
| 124 | }); | |
| 125 | ||
| 126 | descri be('submit ', functio n() { | |
| 127 | va r context, called; | |
| 128 | ||
| 129 | be foreEach(f unction() { | |
| 130 | environm ent.jds = new JdsCli entDummy(l ogger, con fig); | |
| 131 | context = errorPro cessingApi .ErrorProc essingCont ext(logger , config, environmen t, {}); | |
| 132 | ||
| 133 | called = false; | |
| 134 | }) ; | |
| 135 | ||
| 136 | it ('fetch er ror thrown ', functio n() { | |
| 137 | environm ent.jds._s etResponse Data([null ], [{statu sCode: 500 }], {error : 'error'} ); | |
| 138 | ||
| 139 | runs(fun ction() { | |
| 140 | erro rProcessin gApi.submi t(context, function( error, res ults) { | |
| 141 | expect(err or).toBeTr uthy(); | |
| 142 | expect(res ults).toBe Falsy(); | |
| 143 | ||
| 144 | called = t rue; | |
| 145 | }); | |
| 146 | }); | |
| 147 | ||
| 148 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 149 | }) ; | |
| 150 | ||
| 151 | it ('jds retu rns no ite ms', funct ion() { | |
| 152 | environm ent.jds._s etResponse Data([null ], [{statu sCode: 200 }], {items : []}); | |
| 153 | ||
| 154 | runs(fun ction() { | |
| 155 | erro rProcessin gApi.submi t(context, function( error, res ults) { | |
| 156 | expect(err or).toBeFa lsy(); | |
| 157 | expect(res ults).toBe ('No recor ds to proc ess.'); | |
| 158 | ||
| 159 | called = t rue; | |
| 160 | }); | |
| 161 | }); | |
| 162 | ||
| 163 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 164 | }) ; | |
| 165 | ||
| 166 | it ('successf ul submit' , function () { | |
| 167 | environm ent.jds._s etResponse Data( | |
| 168 | [nul l], | |
| 169 | [{st atusCode: 200}, {sta tusCode: 2 00}, {stat usCode: 20 0}], | |
| 170 | {ite ms: [{uid: '1'}]}); | |
| 171 | ||
| 172 | runs(fun ction() { | |
| 173 | erro rProcessin gApi.submi t(context, function( error, res ults) { | |
| 174 | expect(err or).toBeFa lsy(); | |
| 175 | expect(res ults).toBe Falsy(); | |
| 176 | ||
| 177 | expect(con text.resul ts).toBeDe fined(); | |
| 178 | expect(con text.resul ts.length) .toBe(1); | |
| 179 | ||
| 180 | called = t rue; | |
| 181 | }); | |
| 182 | }); | |
| 183 | ||
| 184 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 185 | }) ; | |
| 186 | }); | |
| 187 | ||
| 188 | descri be('submit ByBatchQue ry', funct ion() { | |
| 189 | va r context, called; | |
| 190 | ||
| 191 | be foreEach(f unction() { | |
| 192 | environm ent.jds = new JdsCli entDummy(l ogger, con fig); | |
| 193 | context = errorPro cessingApi .ErrorProc essingCont ext(logger , config, environmen t, {}); | |
| 194 | ||
| 195 | called = false; | |
| 196 | }) ; | |
| 197 | ||
| 198 | it ('fetch er ror thrown ', functio n() { | |
| 199 | environm ent.jds._s etResponse Data([null ], [{statu sCode: 500 }], {error : 'error'} ); | |
| 200 | ||
| 201 | runs(fun ction() { | |
| 202 | erro rProcessin gApi.submi tByBatchQu ery(contex t, functio n(error, r esults) { | |
| 203 | expect(err or).toBeTr uthy(); | |
| 204 | expect(res ults).toBe Falsy(); | |
| 205 | ||
| 206 | called = t rue; | |
| 207 | }); | |
| 208 | }); | |
| 209 | ||
| 210 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 211 | }) ; | |
| 212 | ||
| 213 | it ('successf ul submit' , function () { | |
| 214 | environm ent.jds._s etResponse Data( | |
| 215 | [nul l, null, n ull, null] , | |
| 216 | [{st atusCode: 200}, {sta tusCode: 2 00}, {stat usCode: 20 0}, {statu sCode: 200 }], | |
| 217 | [{it ems: [{uid : '1'}]}, null, null , {items: []}]); | |
| 218 | ||
| 219 | runs(fun ction() { | |
| 220 | erro rProcessin gApi.submi tByBatchQu ery(contex t, functio n(error, r esults) { | |
| 221 | expect(err or).toBeFa lsy(); | |
| 222 | expect(res ults).toBe Falsy(); | |
| 223 | ||
| 224 | expect(con text.resul ts).toBeDe fined(); | |
| 225 | expect(con text.resul ts.length) .toBe(1); | |
| 226 | ||
| 227 | called = t rue; | |
| 228 | }); | |
| 229 | }); | |
| 230 | ||
| 231 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 232 | }) ; | |
| 233 | ||
| 234 | }); | |
| 235 | ||
| 236 | descri be('submit ByUid', fu nction() { | |
| 237 | va r context, called; | |
| 238 | ||
| 239 | be foreEach(f unction() { | |
| 240 | environm ent.jds = new JdsCli entDummy(l ogger, con fig); | |
| 241 | context = errorPro cessingApi .ErrorProc essingCont ext(logger , config, environmen t, {}); | |
| 242 | ||
| 243 | called = false; | |
| 244 | }) ; | |
| 245 | ||
| 246 | it ('fetch er ror thrown ', functio n() { | |
| 247 | environm ent.jds._s etResponse Data(['Con nection Er ror'], [nu ll], null) ; | |
| 248 | ||
| 249 | runs(fun ction() { | |
| 250 | erro rProcessin gApi.submi tByUid(1, context, f unction(er ror, resul ts) { | |
| 251 | expect(err or).toBeTr uthy(); | |
| 252 | expect(res ults).toBe Falsy(); | |
| 253 | ||
| 254 | called = t rue; | |
| 255 | }); | |
| 256 | }); | |
| 257 | ||
| 258 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 259 | }) ; | |
| 260 | ||
| 261 | it ('jds resp onse error ', functio n() { | |
| 262 | environm ent.jds._s etResponse Data([null ], [{statu sCode: 500 }], {error : 'error'} ); | |
| 263 | ||
| 264 | runs(fun ction() { | |
| 265 | erro rProcessin gApi.submi tByUid(1, context, f unction(er ror, resul ts) { | |
| 266 | expect(err or).toBeTr uthy(); | |
| 267 | expect(res ults).toBe Falsy(); | |
| 268 | ||
| 269 | called = t rue; | |
| 270 | }); | |
| 271 | }); | |
| 272 | ||
| 273 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 274 | }) ; | |
| 275 | ||
| 276 | it ('jds retu rns no ite ms', funct ion() { | |
| 277 | environm ent.jds._s etResponse Data([null ], [{statu sCode: 200 }], {}); | |
| 278 | ||
| 279 | runs(fun ction() { | |
| 280 | erro rProcessin gApi.submi tByUid(1, context, f unction(er ror, resul ts) { | |
| 281 | expect(err or).toBeFa lsy(); | |
| 282 | expect(res ults).toBe ('No recor d to proce ss.'); | |
| 283 | ||
| 284 | called = t rue; | |
| 285 | }); | |
| 286 | }); | |
| 287 | ||
| 288 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 289 | }) ; | |
| 290 | ||
| 291 | it ('successf ul submit' , function () { | |
| 292 | environm ent.jds._s etResponse Data( | |
| 293 | [nul l], | |
| 294 | [{st atusCode: 200}, {sta tusCode: 2 00}, {stat usCode: 20 0}], | |
| 295 | {ite ms: [{uid: '1'}]}); | |
| 296 | ||
| 297 | runs(fun ction() { | |
| 298 | erro rProcessin gApi.submi tByUid(1, context, f unction(er ror, resul ts) { | |
| 299 | expect(err or).toBeFa lsy(); | |
| 300 | expect(res ults).toBe Falsy(); | |
| 301 | ||
| 302 | expect(con text.resul ts).toBeDe fined(); | |
| 303 | expect(con text.resul ts.length) .toBe(1); | |
| 304 | ||
| 305 | called = t rue; | |
| 306 | }); | |
| 307 | }); | |
| 308 | ||
| 309 | waitsFor (function( ) {return called;}, 'should be called', 500); | |
| 310 | }) ; | |
| 311 | }); | |
| 312 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.