Produced by Araxis Merge on 10/4/2017 8:04:35 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 | rdk.zip\rdk\product\production\rdk\src\resources\user | get-user-list-spec.js | Mon Aug 21 12:51:07 2017 UTC |
| 2 | rdk.zip\rdk\product\production\rdk\src\resources\user | get-user-list-spec.js | Tue Oct 3 18:24:21 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 23 | 466 |
| Changed | 22 | 58 |
| 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 | var _ = re quire('lod ash'); | |
| 4 | var nock = require(' nock'); | |
| 5 | var httpMo cks = requ ire('node- mocks-http '); | |
| 6 | var rdk = require('. ./../core/ rdk'); | |
| 7 | var RdkErr or = rdk.u tils.RdkEr ror; | |
| 8 | var userLi st = requi re('./get- user-list' ); | |
| 9 | var logger = sinon.s tub(requir e('bunyan' ).createLo gger({ | |
| 10 | name: 'get-user- list-spec' | |
| 11 | })); | |
| 12 | /*jshint - W109:start */ | |
| 13 | var expect ed = { | |
| 14 | "duz": "1111", | |
| 15 | "exact MatchCount ": 1, | |
| 16 | "facil ity": "", | |
| 17 | "fname ": "Bob", | |
| 18 | "lname ": "Doe", | |
| 19 | "permi ssionSet": { | |
| 20 | "v al": ["thi nk-about-i t"] | |
| 21 | }, | |
| 22 | "site": " R E D A CTED ", | |
| 23 | "statu s": "activ e", | |
| 24 | "uid": "ur n:va:user: R E D A CTED :1111", | |
| 25 | "vista Status": " active" | |
| 26 | }; | |
| 27 | /*jshint - W109:end * / | |
| 28 | ||
| 29 | var blankR esponse = { | |
| 30 | update d: 2017062 7095453, | |
| 31 | totalI tems: 0, | |
| 32 | curren tItemCount : 0, | |
| 33 | items: [] | |
| 34 | }; | |
| 35 | ||
| 36 | var jdsRes ponse = { | |
| 37 | data: { | |
| 38 | up dated: 201 7062709545 3, | |
| 39 | to talItems: 0, | |
| 40 | cu rrentItemC ount: 0, | |
| 41 | it ems: [{ | |
| 42 | uid: 'urn: va:user: R E D A CTED :1111', | |
| 43 | name: 'D oe,Bob' | |
| 44 | }] | |
| 45 | } | |
| 46 | }; | |
| 47 | ||
| 48 | var pjdsRe sponse = { | |
| 49 | update d: 2017062 7095453, | |
| 50 | totalI tems: 0, | |
| 51 | curren tItemCount : 0, | |
| 52 | items: [{ | |
| 53 | uid: 'urn: va:user: R E D A CTED :1111', | |
| 54 | pe rmissionSe t: { | |
| 55 | val: ['t hink-about -it'] | |
| 56 | } | |
| 57 | }] | |
| 58 | }; | |
| 59 | ||
| 60 | describe(' getUserLis t', functi on () { | |
| 61 | ||
| 62 | var re q; | |
| 63 | var re s; | |
| 64 | ||
| 65 | before Each(funct ion () { | |
| 66 | re q = buildR equest(); | |
| 67 | re s = { | |
| 68 | status: function ( stat) { | |
| 69 | this .statusCod e = stat; | |
| 70 | retu rn this; | |
| 71 | }, | |
| 72 | rdkSend: function (data) { | |
| 73 | retu rn data; | |
| 74 | } | |
| 75 | }; | |
| 76 | }); | |
| 77 | ||
| 78 | afterE ach(functi on () { | |
| 79 | no ck.cleanAl l(); | |
| 80 | }); | |
| 81 | ||
| 82 | it('re turns an e mpty colle ction if r equested', function () { | |
| 83 | re q.params = { | |
| 84 | fetchEmp tyCollecti on: 'true' | |
| 85 | }; | |
| 86 | re q.rdkSend = function (data){ | |
| 87 | expect(d ata).to.eq l([]); | |
| 88 | }; | |
| 89 | us erList.get UserList(r eq, res); | |
| 90 | }); | |
| 91 | ||
| 92 | it('ha ndles an u nparsable user.filte r', functi on () { | |
| 93 | _.set(req, 'query', '{uid: "ur n:va:user: R E D A CTED :1111", pe rmissionS' ); | |
| 94 | ||
| 95 | re q.rdkSend = function (data){ | |
| 96 | expect(d ata).to.eq l('Cannot parse filt er paramet ers'); | |
| 97 | }; | |
| 98 | ||
| 99 | us erList.get UserList(r eq, res); | |
| 100 | }); | |
| 101 | ||
| 102 | it('ha ndles an e rror from pjds', fun ction (don e) { | |
| 103 | re s.rdkSend = function (data) { | |
| 104 | expect(d ata).to.ma tch(/An er ror occure d processi ng the res ults of us er data/); | |
| 105 | done(); | |
| 106 | }; | |
| 107 | ||
| 108 | nock('http :// IP ') | |
| 109 | .get('/e hmpusers/i ndex/ehmpu sers_uid') | |
| 110 | .replyWi thError({c ode: 404, message: ' Broken bey ond repair .'}); | |
| 111 | ||
| 112 | nock('http :// IP ') | |
| 113 | .get('/dat a/index/us er-uid?fil ter=or(eq( %22localId %22%2C%221 111%22)%2C ilike(%22u id%22%2C%2 2%251111%2 5%22))%2Cn e(%22disus er%22%2C%2 2true%22)% 2Cne(%22te rminated%2 2%2C%22tru e%22)&orde r=name%20a sc&range=u rn%3Ava%3A user%3 R E D A CTED %3A*') | |
| 114 | .reply(2 00, {data: jdsRespon se}); | |
| 115 | ||
| 116 | us erList.get UserList(r eq, res); | |
| 117 | }); | |
| 118 | ||
| 119 | it('ha ndles an e rror from jds', func tion (done ) { | |
| 120 | re s.rdkSend = function (data) { | |
| 121 | expect(d ata).to.no t.be.insta nceOf(RdkE rror); | |
| 122 | expect(d ata).to.ma tch(/Expec ted JDS Co nditions w ere not me t for a li st of user s/); | |
| 123 | done(); | |
| 124 | }; | |
| 125 | ||
| 126 | nock('http :// IP ') | |
| 127 | .get('/e hmpusers/i ndex/ehmpu sers_uid') | |
| 128 | .reply(2 00, pjdsRe sponse); | |
| 129 | ||
| 130 | nock('http :// IP ') | |
| 131 | .get('/dat a/index/us er-uid?fil ter=or(eq( %22localId %22%2C%221 111%22)%2C ilike(%22u id%22%2C%2 2%251111%2 5%22))%2Cn e(%22disus er%22%2C%2 2true%22)% 2Cne(%22te rminated%2 2%2C%22tru e%22)&orde r=name%20a sc&range=u rn%3Ava%3A user%3 R E D A CTED %3A*') | |
| 132 | .reply({ code: 404, message: 'This is a stupid er ror, make ready the warhammers !'}); | |
| 133 | ||
| 134 | us erList.get UserList(r eq, res); | |
| 135 | }); | |
| 136 | ||
| 137 | it('ha ndles an e mpty respo nse from j ds', funct ion (done) { | |
| 138 | re s.rdkSend = function (data) { | |
| 139 | expect(d ata).to.no t.be.insta nceOf(RdkE rror); | |
| 140 | expect(d ata).to.be .empty(); | |
| 141 | done(); | |
| 142 | }; | |
| 143 | ||
| 144 | nock('http :// IP ') | |
| 145 | .get('/e hmpusers/i ndex/ehmpu sers_uid') | |
| 146 | .reply(2 00, pjdsRe sponse); | |
| 147 | ||
| 148 | nock('http :// IP ') | |
| 149 | .get('/dat a/index/us er-uid?fil ter=or(eq( %22localId %22%2C%221 111%22)%2C ilike(%22u id%22%2C%2 2%251111%2 5%22))%2Cn e(%22disus er%22%2C%2 2true%22)% 2Cne(%22te rminated%2 2%2C%22tru e%22)&orde r=name%20a sc&range=u rn%3Ava%3A user%3 R E D A CTED %3A*') | |
| 150 | .reply(2 00, {data: blankResp onse}); | |
| 151 | ||
| 152 | us erList.get UserList(r eq, res); | |
| 153 | }); | |
| 154 | ||
| 155 | it('ha ndles an e mpty respo nse from p jds', func tion (done ) { | |
| 156 | re s.rdkSend = function (data) { | |
| 157 | expect(d ata).to.no t.be.insta nceOf(RdkE rror); | |
| 158 | expect(d ata).to.be .empty(); | |
| 159 | done(); | |
| 160 | }; | |
| 161 | ||
| 162 | nock('http :// IP ') | |
| 163 | .get('/e hmpusers/i ndex/ehmpu sers_uid') | |
| 164 | .reply(2 00, blankR esponse); | |
| 165 | ||
| 166 | nock('http :// IP ') | |
| 167 | .get('/dat a/index/us er-uid?fil ter=or(eq( %22localId %22%2C%221 111%22)%2C ilike(%22u id%22%2C%2 2%251111%2 5%22))%2Cn e(%22disus er%22%2C%2 2true%22)% 2Cne(%22te rminated%2 2%2C%22tru e%22)&orde r=name%20a sc&range=u rn%3Ava%3A user%3 R E D A CTED %3A*') | |
| 168 | .reply(2 00, jdsRes ponse); | |
| 169 | ||
| 170 | us erList.get UserList(r eq, res); | |
| 171 | }); | |
| 172 | ||
| 173 | it('pr operly rem oves any b ad data fr om jds', f unction (d one) { | |
| 174 | var items = _.union( [{uid: 'ur n:va:user: R E D A CTED :1117'}], jdsRespons e.data.ite ms); | |
| 175 | re s.rdkSend = function (data) { | |
| 176 | expect(d ata).to.no t.be. | |
| 177 | empty(); | |
| 178 | expect(d ata[0]).to .have.keys (['duz', ' exactMatch Count', 'f acility', 'fname', ' lname', 'p ermissionS et', 'site ', 'status ', 'uid', 'vistaStat us']); | |
| 179 | done(); | |
| 180 | }; | |
| 181 | ||
| 182 | nock('http :// IP ') | |
| 183 | .get('/e hmpusers/i ndex/ehmpu sers_uid') | |
| 184 | .reply(2 00, pjdsRe sponse); | |
| 185 | ||
| 186 | nock('http :// IP ') | |
| 187 | .get('/dat a/index/us er-uid?fil ter=or(eq( %22localId %22%2C%221 111%22)%2C ilike(%22u id%22%2C%2 2%251111%2 5%22))%2Cn e(%22disus er%22%2C%2 2true%22)% 2Cne(%22te rminated%2 2%2C%22tru e%22)&orde r=name%20a sc&range=u rn%3Ava%3A user%3 R E D A CTED %3A*') | |
| 188 | .reply(2 00, { | |
| 189 | data : { | |
| 190 | items: ite ms | |
| 191 | } | |
| 192 | }); | |
| 193 | ||
| 194 | us erList.get UserList(r eq, res); | |
| 195 | }); | |
| 196 | ||
| 197 | it('ha ndles merg er from jd s and pjds ', functio n (done) { | |
| 198 | re s.rdkSend = function (data) { | |
| 199 | expect(d ata).to.no t.be. | |
| 200 | empty(); | |
| 201 | expect(d ata[0]).to .be.eql(ex pected); | |
| 202 | done(); | |
| 203 | }; | |
| 204 | ||
| 205 | nock('http :// IP ') | |
| 206 | .get('/e hmpusers/i ndex/ehmpu sers_uid') | |
| 207 | .reply(2 00, pjdsRe sponse); | |
| 208 | ||
| 209 | nock('http :// IP ') | |
| 210 | .get('/dat a/index/us er-uid?fil ter=or(eq( %22localId %22%2C%221 111%22)%2C ilike(%22u id%22%2C%2 2%251111%2 5%22))%2Cn e(%22disus er%22%2C%2 2true%22)% 2Cne(%22te rminated%2 2%2C%22tru e%22)&orde r=name%20a sc&range=u rn%3Ava%3A user%3 R E D A CTED %3A*') | |
| 211 | .reply(2 00, jdsRes ponse); | |
| 212 | ||
| 213 | us erList.get UserList(r eq, res); | |
| 214 | }); | |
| 215 | ||
| 216 | ||
| 217 | functi on buildRe quest(defa ults) { | |
| 218 | va r request = _.merge( httpMocks. createRequ est({ | |
| 219 | method: 'GET', | |
| 220 | url: '/u ser/list', | |
| 221 | params: { | |
| 222 | 'use r.filter': '{"duz":1 111}' | |
| 223 | } | |
| 224 | }) , defaults ); | |
| 225 | ||
| 226 | re quest.logg er = logge r; | |
| 227 | ||
| 228 | re quest.audi t = {}; | |
| 229 | ||
| 230 | re quest.sess ion = { | |
| 231 | user: { | |
| 232 | uid: 'urn: va:user: R E D A CTED :007', | |
| 233 | site: ' R E D A CTED ' | |
| 234 | } | |
| 235 | }; | |
| 236 | ||
| 237 | re quest.app = { | |
| 238 | config: { | |
| 239 | jdsS erver: { | |
| 240 | baseUrl: ' http:// IP ', | |
| 241 | urlLengthL imit: 120 | |
| 242 | }, | |
| 243 | gene ralPurpose JdsServer: { | |
| 244 | baseUrl: ' http:// IP ', | |
| 245 | urlLengthL imit: 120 | |
| 246 | }, | |
| 247 | vist aSites: { | |
| 248 | ' R E D A CTED ': { | |
| 249 | divisi on: [ | |
| 250 | { | |
| 251 | id:500, | |
| 252 | name: 'P anny' | |
| 253 | } | |
| 254 | ] | |
| 255 | } | |
| 256 | } | |
| 257 | } | |
| 258 | }; | |
| 259 | ||
| 260 | re turn reque st; | |
| 261 | } | |
| 262 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.