Produced by Araxis Merge on 4/8/2019 1:00:39 PM 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 | C:\AraxisMergeCompare\Pri_un\crp-fitheart-release-2.0\app\src\core\services | auth_service_spec.js | Wed Mar 20 17:30:00 2019 UTC |
| 2 | C:\AraxisMergeCompare\Pri_re\MHED P3 Healthshare 2.0-redacted\crp-fitheart-release-2.0\app\src\core\services | auth_service_spec.js | Mon Apr 8 16:58:12 2019 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 262 |
| Changed | 2 | 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 | define(['a uthenticat ion_servic e'], funct ion () { | |
| 2 | 'use s trict'; | |
| 3 | ||
| 4 | descri be('Authen tication S ervice --' , function () { | |
| 5 | va r $scope, | |
| 6 | $http, | |
| 7 | $httpBac kend, | |
| 8 | $q, | |
| 9 | $window, | |
| 10 | $locatio n, | |
| 11 | $injecto r, | |
| 12 | service, | |
| 13 | localRes ourceDirec tory, | |
| 14 | localRes ourceDirec toryServic eMock, | |
| 15 | patientF HIRService , | |
| 16 | patientF HIRService Mock, | |
| 17 | localDef erred, | |
| 18 | pageServ iceMock, | |
| 19 | windowOp enSpy; | |
| 20 | ||
| 21 | be foreEach(f unction() { | |
| 22 | module(' angularTem plateApp') ; | |
| 23 | ||
| 24 | localRes ourceDirec toryServic eMock = ja smine.crea teSpyObj(' localResou rceDirecto ry', ['fet ch']); | |
| 25 | pageServ iceMock = jasmine.cr eateSpyObj ('pageServ ice', ['wa rnLaunchpa dNotInstal led']); | |
| 26 | patientF HIRService Mock = jas mine.creat eSpyObj('p atientFHIR Service', ['setPatie ntContext' ]); | |
| 27 | ||
| 28 | // resou rceDirecto ry returns a hash of keys to U RL values for resour ce endpoin ts | |
| 29 | localRes ourceDirec tory = { | |
| 30 | 'use rs-logout' : '/users -logout', | |
| 31 | 'use rs-login' : '/users -login' | |
| 32 | }; | |
| 33 | ||
| 34 | module(f unction($p rovide) { | |
| 35 | $pro vide.value ('localRes ourceDirec toryServic e', localR esourceDir ectoryServ iceMock); | |
| 36 | $pro vide.value ('pageServ ice', page ServiceMoc k); | |
| 37 | $pro vide.value ('PatientF HIRService ', patient FHIRServic eMock); | |
| 38 | }); | |
| 39 | ||
| 40 | inject(f unction($r ootScope, _$http_, _ $httpBacke nd_, _$q_, _$window_ , _$locati on_, _$inj ector_, au thenticati onService, PatientFH IRService) { | |
| 41 | $sco pe = $root Scope; | |
| 42 | $q = _$q_; | |
| 43 | $win dow = _$wi ndow_; | |
| 44 | $loc ation = _$ location_; | |
| 45 | $inj ector = _$ injector_; | |
| 46 | pati entFHIRSer vice = Pat ientFHIRSe rvice; | |
| 47 | serv ice = auth entication Service; | |
| 48 | ||
| 49 | var resourceDe ferred = $ q.defer(); | |
| 50 | reso urceDeferr ed.resolve (localReso urceDirect ory); | |
| 51 | loca lResourceD irectorySe rviceMock. fetch.and. returnValu e(resource Deferred.p romise); | |
| 52 | }); | |
| 53 | }) ; | |
| 54 | ||
| 55 | de scribe('th e service' , function () { | |
| 56 | var cookie Name = ' DNS '; | |
| 57 | ||
| 58 | document .cookie = cookieName + 'REDACT ED'; | |
| 59 | ||
| 60 | beforeEa ch(functio n () { | |
| 61 | wind owOpenSpy = spyOn(wi ndow, 'ope n'); | |
| 62 | ||
| 63 | loca lDeferred = $q.defer (); | |
| 64 | loca lDeferred. resolve('s uccess'); // general resolved/ success pr omise | |
| 65 | }); | |
| 66 | ||
| 67 | it('shou ld have so me commonl y used met hods defin ed', funct ion () { | |
| 68 | expe ct(service .authorize ).toBeDefi ned(); | |
| 69 | expe ct(service .authentic ate).toBeD efined(); | |
| 70 | expe ct(service .deleteCoo kie).toBeD efined(); | |
| 71 | expe ct(service .gotoLogou tWithRedir ect).toBeD efined(); | |
| 72 | expe ct(service .gotoLogin WithRedire ct).toBeDe fined(); | |
| 73 | expe ct(service .checkAuth Status).to BeDefined( ); | |
| 74 | expe ct(service .isAuthent icated).to BeDefined( ); | |
| 75 | expe ct(service .checkJwtT oken).toBe Defined(); | |
| 76 | }); | |
| 77 | ||
| 78 | it('shou ld return true if us er is auth enticated' , function () { | |
| 79 | serv ice.isAuth enticated = true; | |
| 80 | ||
| 81 | expe ct(service .isAuthent icated).to Equal(true ); | |
| 82 | }); | |
| 83 | ||
| 84 | it('shou ld return false if u ser is not authentic ated', fun ction () { | |
| 85 | serv ice.isAuth enticated = false; | |
| 86 | ||
| 87 | expe ct(service .isAuthent icated).to Equal(fals e); | |
| 88 | }); | |
| 89 | ||
| 90 | it('shou ld call au thorize if user is n ot authent icated', f unction () { | |
| 91 | spyO n(service, 'isAuthen ticated'). and.return Value(fals e); | |
| 92 | spyO n(service, 'authoriz e'); | |
| 93 | serv ice.authen ticate(); | |
| 94 | ||
| 95 | expe ct(service .authorize ).toHaveBe enCalled() ; | |
| 96 | }); | |
| 97 | ||
| 98 | it('shou ld logout and redire ct to laun chpad', fu nction () { | |
| 99 | serv ice.gotoLo goutWithRe direct(); | |
| 100 | ||
| 101 | expe ct(localRe sourceDire ctoryServi ceMock.fet ch).toHave BeenCalled (); | |
| 102 | }); | |
| 103 | ||
| 104 | it('shou ld get Jwt expiratio n', functi on () { | |
| 105 | var tokenData = {}; | |
| 106 | toke nData = se rvice.getP arsedToken (); | |
| 107 | expe ct(tokenDa ta.exp).to Equal(1498 509293); | |
| 108 | }); | |
| 109 | }) ; | |
| 110 | ||
| 111 | de scribe('ch eckAuthSta tus Functi on', funct ion () { | |
| 112 | var retu rnValue; | |
| 113 | ||
| 114 | beforeEa ch(functio n () { | |
| 115 | spyO n(service, 'checkJwt Token').an d.returnVa lue({ | |
| 116 | then: func tion(cb) { | |
| 117 | return cb(return Value); | |
| 118 | } | |
| 119 | }); | |
| 120 | }); | |
| 121 | ||
| 122 | it('shou ld be a fu nction', f unction () { | |
| 123 | expe ct(typeof( service.ch eckAuthSta tus)).toEq ual('funct ion'); | |
| 124 | }); | |
| 125 | ||
| 126 | it('shou ld check J wt token', function () { | |
| 127 | serv ice.checkA uthStatus( ); | |
| 128 | ||
| 129 | expe ct(service .checkJwtT oken).toHa veBeenCall ed(); | |
| 130 | }); | |
| 131 | }) ; | |
| 132 | }); | |
| 133 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.