Produced by Araxis Merge on 7/25/2018 3:40:54 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 | Pain_Coach_v3.0_Jun_2018.zip\vpc-patient-web.zip\vpc-patient-web\app\common\js\test | veteran-pgd-fhir.js | Fri Jun 1 14:27:13 2018 UTC |
2 | Pain_Coach_v3.0_Jun_2018.zip\vpc-patient-web.zip\vpc-patient-web\app\common\js\test | veteran-pgd-fhir.js | Tue Jul 24 19:09:53 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 784 |
Changed | 1 | 2 |
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 | var pgdMod elResource s = getJSO NFixture(' pgdModelRe sources.js on'); | |
2 | VPC.Resour ces.PgdMod el = new A pp_Resourc es.Collect ion.PgdMod elResource s(); | |
3 | VPC.Resour ces.PgdMod el.reset(p gdModelRes ources.res ources); | |
4 | ||
5 | describe(" PGD FHIR", function () { | |
6 | descri be("Base M odel", fun ction () { | |
7 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
8 | baseMode l = new VP C.Model.Pg dBaseModel (); | |
9 | ba seModel.se t('resourc e', pgdMod els.pgdPai nDiaryHigh ); | |
10 | ||
11 | it ('PGD Base Model getU niqueIdent ifier func tion shoul d return u nique iden tifier', f unction () { | |
12 | expect(b aseModel.g etUniqueId entifier() ).toBe("80 ff5441-6f4 1-4252-a04 2-f5ba5a9e c405"); | |
13 | }) ; | |
14 | }); | |
15 | ||
16 | descri be("Base Q uestionnai re", funct ion () { | |
17 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
18 | question naireModel = new VPC .Model.Pgd Questionna ire(); | |
19 | qu estionnair eModel.set ('resource ', pgdMode ls.monthly Assessment Questionna ire); | |
20 | ||
21 | it ('PGD Base Questionna ire getCho iceOptions function should ret urn reques ted choice options', function () { | |
22 | expect(q uestionnai reModel.ge tChoiceOpt ions("1.6" )).toEqual ([{ | |
23 | "cod e": "0", | |
24 | "dis play": "0 - Not At A ll" | |
25 | }, { | |
26 | "cod e": "1", | |
27 | "dis play": "1 - Several Days" | |
28 | }, { | |
29 | "cod e": "2", | |
30 | "dis play": "2 - More Tha n Half The Days" | |
31 | }, { | |
32 | "cod e": "3", | |
33 | "dis play": "3 - Nearly E veryday" | |
34 | }]); | |
35 | expect(q uestionnai reModel.ge tChoiceOpt ions("2.1" )).toBe(un defined); | |
36 | }) ; | |
37 | ||
38 | it ('PGD Base Questionna ire getQue stionnaire Id functio n should r eturn ques tionnaire id', funct ion () { | |
39 | expect(q uestionnai reModel.ge tQuestionn aireId()). toBe("4b30 323b-19fe- 4a68-9f7e- 11ae6142f8 6f"); | |
40 | }) ; | |
41 | }); | |
42 | ||
43 | descri be("Base Q uestionnai reResponse ", functio n () { | |
44 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
45 | monthlyA ssessmentR esponseMod el = new V PC.Model.P gdQuestion naireRespo nse(), | |
46 | activity PacingResp onseModel = new VPC. Model.PgdQ uestionnai reResponse (), | |
47 | monthlyA ssessmentQ uestionnai reModel = new VPC.Mo del.PgdQue stionnaire (); | |
48 | mo nthlyAsses smentRespo nseModel.s et('resour ce', pgdMo dels.month lyAssessme ntResponse High); | |
49 | ac tivityPaci ngResponse Model.set( 'resource' , pgdModel s.activity PacingResp onseReadin g); | |
50 | mo nthlyAsses smentQuest ionnaireMo del.set('r esource', pgdModels. monthlyAss essmentQue stionnaire ); | |
51 | ||
52 | it ('PGD Base Questionna ireRespons e getAnswe r function should re turn answe r for requ ested ques tion', fun ction () { | |
53 | expect(m onthlyAsse ssmentResp onseModel. getAnswer( "monthlyAs sessment", "painInte rferenceGe neral")).t oEqual({ | |
54 | "cod e": 7, | |
55 | "system": "https:// URL /display/P GDMS/Clien t+Provenan ce+Mapping ", | |
56 | "dis play": "7" | |
57 | }); | |
58 | expect(m onthlyAsse ssmentResp onseModel. getAnswer( "monthlyAs sessment", "noAnswer ")).toBe(n ull); | |
59 | ||
60 | expect(a ctivityPac ingRespons eModel.get Answer("ac tivityPaci ng", "wors eHours")). toBe(1); | |
61 | expect(a ctivityPac ingRespons eModel.get Answer("ac tivityPaci ng", "noAn swer")).to Be(null); | |
62 | }) ; | |
63 | ||
64 | it ('PGD Base Questionna ireRespons e setAnswe r function should se t answer f or specifi ed questio n', functi on () { | |
65 | expect(a ctivityPac ingRespons eModel.set Answer("ac tivityPaci ng", "wors eHours", 3 )).toEqual ({ | |
66 | valu eInteger: 3 | |
67 | }); | |
68 | expect(a ctivityPac ingRespons eModel.get Answer("ac tivityPaci ng", "wors eHours")). toBe(3); | |
69 | ||
70 | expect(a ctivityPac ingRespons eModel.set Answer("ac tivityPaci ng", "noAn swer")).to Be(null); | |
71 | }) ; | |
72 | ||
73 | it ('PGD Base Questionna ireRespons e setAnswe rChoice fu nction sho uld set an swer for s pecified c hoice ques tion', fun ction () { | |
74 | expect(m onthlyAsse ssmentResp onseModel. setAnswerC hoice(mont hlyAssessm entQuestio nnaireMode l, "monthl yAssessmen t", "depre ssion", 1) ).toEqual( { | |
75 | "cod e": "1", | |
76 | "dis play": "1 - Several Days" | |
77 | }); | |
78 | expect(m onthlyAsse ssmentResp onseModel. getAnswer( "monthlyAs sessment", "depressi on")).toEq ual({ | |
79 | "cod e": "1", | |
80 | "dis play": "1 - Several Days" | |
81 | }); | |
82 | ||
83 | expect(m onthlyAsse ssmentResp onseModel. setAnswerC hoice(mont hlyAssessm entQuestio nnaireMode l, "monthl yAssessmen t", "noAns wer", 4)). toBe(null) ; | |
84 | }) ; | |
85 | }); | |
86 | ||
87 | descri be("Sub Ac tivityPaci ng", funct ion () { | |
88 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
89 | activity PacingMode l = new VP C.Model.Pg dActivityP acing(); | |
90 | ac tivityPaci ngModel.se t('resourc e', pgdMod els.activi tyPacingRe sponseRead ing); | |
91 | ||
92 | it ('PGD SubA ctivityPac ing valida te functio n should r eturn corr ect error messages o r empty st ring if va lid', func tion () { | |
93 | expect(a ctivityPac ingModel.v alidate()) .toBe(''); | |
94 | ||
95 | activity PacingMode l.setAnswe r("activit yPacing", "worseHour s", null); | |
96 | activity PacingMode l.setAnswe r("activit yPacing", "worseMinu tes", null ); | |
97 | expect(a ctivityPac ingModel.v alidate()) .toBe('<ul ><li>How l ong can yo u do the a ctivity be fore pain gets worse is missin g</li></ul >'); | |
98 | }) ; | |
99 | }); | |
100 | ||
101 | descri be("Sub Mo nthlyAsses sment", fu nction () { | |
102 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
103 | monthlyA ssessmentM odel = new VPC.Model .PgdMonthl yAssessmen t(); | |
104 | mo nthlyAsses smentModel .set('reso urce', pgd Models.mon thlyAssess mentRespon seHigh); | |
105 | ||
106 | it ('PGD SubM onthlyAsse ssment get AuthoredDa te functio n should r eturn last updated d ate', func tion () { | |
107 | expect(m onthlyAsse ssmentMode l.getAutho redDate()) .toBe("201 8-04-26T15 :43:23.586 +00:00"); | |
108 | }) ; | |
109 | ||
110 | it ('PGD SubM onthlyAsse ssment set AuthoredDa te functio n should s et last up dated date ', functio n () { | |
111 | expect(m onthlyAsse ssmentMode l.setAutho redDate("2 018-05-27T 20:20:05.6 88+00:00") ).toBe("20 18-05-27T2 0:20:05.68 8+00:00"); | |
112 | expect(m onthlyAsse ssmentMode l.getAutho redDate()) .toBe("201 8-05-27T20 :20:05.688 +00:00"); | |
113 | }) ; | |
114 | ||
115 | it ('PGD SubM onthlyAsse ssment pai nInterfere nce functi on should return pai nInterfere nce value' , function () { | |
116 | expect(m onthlyAsse ssmentMode l.painInte rference() ).toBe(8); | |
117 | }) ; | |
118 | ||
119 | it ('PGD SubM onthlyAsse ssment dep ressionSco re functio n should r eturn depr essionScor e value', function ( ) { | |
120 | expect(m onthlyAsse ssmentMode l.depressi onScore()) .toBe(3); | |
121 | }) ; | |
122 | ||
123 | it ('PGD SubM onthlyAsse ssment rep ortDate fu nction sho uld return reportDat e value', function ( ) { | |
124 | expect(m onthlyAsse ssmentMode l.reportDa te()).toBe ('05/27/20 18'); | |
125 | }) ; | |
126 | }); | |
127 | ||
128 | descri be("Sub Pa inDiary", function ( ) { | |
129 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
130 | painDiar yModel = n ew VPC.Mod el.PgdPain Diary(), | |
131 | toolsCol lection = new VPC.Co llection.T oolsUsed() , | |
132 | activity Tool = new VPC.Model .ToolUsed( { | |
133 | 'too lName': 'A ctivity Pa cing', | |
134 | 'too lRating': 7 | |
135 | }), | |
136 | muscleTo ol = new V PC.Model.T oolUsed({ | |
137 | 'too lName': 'M uscle Rela xation', | |
138 | 'too lRating': 4 | |
139 | }); | |
140 | pa inDiaryMod el.set('re source', p gdModels.p gdPainDiar yHigh); | |
141 | to olsCollect ion.add([a ctivityToo l, muscleT ool]); | |
142 | ||
143 | it ('PGD SubP ainDiary v alidate fu nction sho uld return appropria te error m essages', function ( ) { | |
144 | expect(p ainDiaryMo del.valida te()).toBe (''); | |
145 | ||
146 | painDiar yModel.set Answer("pa inDiary", "painRatin g", null); | |
147 | expect(p ainDiaryMo del.valida te()).toBe ('<ul><li> Pain Ratin g is missi ng.</li></ ul>'); | |
148 | painDiar yModel.set Answer("pa inDiary", "painRatin g", 8); | |
149 | }) ; | |
150 | ||
151 | it ('PGD SubP ainDiary " painRating " getAnswe r should r eturn pain rating', function ( ) { | |
152 | expect(p ainDiaryMo del.getAns wer('painD iary', 'pa inRating') ).toBe(8); | |
153 | }) ; | |
154 | ||
155 | it ('PGD SubP ainDiary s etAnswer f or painRat ing should set pain rating', f unction () { | |
156 | painDiar yModel.set Answer("pa inDiary", "painRatin g", 7); | |
157 | expect(p ainDiaryMo del.getAns wer('painD iary', 'pa inRating', true)).to Be(7); | |
158 | }) ; | |
159 | ||
160 | it ('PGD SubP ainDiary s etToolsUse d function should se t tools us ed', funct ion () { | |
161 | painDiar yModel.set ToolsUsed( toolsColle ction); | |
162 | expect(p ainDiaryMo del.getToo lsUsedArra y()).toEqu al([{ | |
163 | 'too lName': 'A ctivity Pa cing', | |
164 | 'too lRating': 7 | |
165 | }, { | |
166 | 'too lName': 'D eep Breath ing', | |
167 | 'too lRating': 2 | |
168 | }, { | |
169 | 'too lName': 'M uscle Rela xation', | |
170 | 'too lRating': 4 | |
171 | }]); | |
172 | }) ; | |
173 | ||
174 | it ('PGD SubP ainDiary g etToolsUse dArray fun ction shou ld return tools used array', f unction () { | |
175 | expect(p ainDiaryMo del.getToo lsUsedArra y()).toEqu al([{ | |
176 | 'too lName': 'A ctivity Pa cing', | |
177 | 'too lRating': 7 | |
178 | }, { | |
179 | 'too lName': 'D eep Breath ing', | |
180 | 'too lRating': 2 | |
181 | }, { | |
182 | 'too lName': 'M uscle Rela xation', | |
183 | 'too lRating': 4 | |
184 | }]); | |
185 | }) ; | |
186 | ||
187 | it ('PGD SubP ainDiary g et depress ionLevel a nswer shou ld return requested value', fu nction () { | |
188 | expect(p ainDiaryMo del.getAns wer("painD iary", "de pressionLe vel")).toB e(4); | |
189 | }) ; | |
190 | ||
191 | it ('PGD SubP ainDiary g et answers for sleep Outcome an d Activity Interferen ce should find the r equested v alues', fu nction () { | |
192 | expect(p ainDiaryMo del.getAns wer("painD iary", "sl eepOutcome ")).toBe(8 ); | |
193 | expect(p ainDiaryMo del.getAns wer("painD iary", "ac tivityInte rference") ).toBe(nul l); | |
194 | }) ; | |
195 | ||
196 | it ('PGD SubP ainDiary s etAnswer f unction sh ould updat e requeste d value if it exists ', functio n () { | |
197 | painDiar yModel.set Answer("pa inDiary", "sleepOutc ome", 9); | |
198 | expect(p ainDiaryMo del.getAns wer("painD iary", "sl eepOutcome ")).toBe(9 ); | |
199 | }) ; | |
200 | ||
201 | it ('PGD SubP ainDiary s etAnswer f unction sh ould set r equested v alue if it does not exist', fu nction () { | |
202 | painDiar yModel.set Answer("pa inDiary", "activityI nterferenc e", 3); | |
203 | expect(p ainDiaryMo del.getAns wer("painD iary", "ac tivityInte rference") ).toBe(3); | |
204 | }) ; | |
205 | ||
206 | it ('PGD SubP ainDiary g etAuthored Date funct ion should return ef fectiveDat eTime', fu nction () { | |
207 | expect(p ainDiaryMo del.getAut horedDate( )).toBe("2 018-04-26T 15:43:23.5 86+00:00") ; | |
208 | }) ; | |
209 | ||
210 | it ('PGD SubP ainDiary s etAuthored Date funct ion should set effec tiveDateTi me', funct ion () { | |
211 | expect(p ainDiaryMo del.setAut horedDate( "2013-05-2 8T12:11:34 -04:00")). toBe("2013 -05-28T12: 11:34-04:0 0"); | |
212 | expect(p ainDiaryMo del.getAut horedDate( )).toBe("2 013-05-28T 12:11:34-0 4:00"); | |
213 | }) ; | |
214 | }); | |
215 | ||
216 | descri be("Sub Re minder", f unction () { | |
217 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
218 | reminder Model = ne w VPC.Mode l.PgdRemin der(); | |
219 | re minderMode l.set('res ource', pg dModels.re minderResp onse); | |
220 | ||
221 | it ('PGD SubR eminder ge tTimeframe function should ret urn remind er timefra me', funct ion () { | |
222 | expect(r eminderMod el.getTime frame()).t oBe(30); | |
223 | }) ; | |
224 | }); | |
225 | ||
226 | descri be("Base C ollection" , function () { | |
227 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
228 | baseMode l = new VP C.Model.Pg dBaseModel (), | |
229 | baseColl ection = n ew VPC.Col lection.Pg dBaseColle ction(); | |
230 | ba seModel.se t('resourc e', pgdMod els.pgdPai nDiaryHigh ); | |
231 | ba seCollecti on.add(bas eModel); | |
232 | ||
233 | it ('PGD Base Collection getByIden tifier fun ction shou ld return model with requested identifie r', functi on () { | |
234 | expect(b aseCollect ion.getByI dentifier( '80ff5441- 6f41-4252- a042-f5ba5 a9ec405')) .toEqual(b aseModel); | |
235 | expect(b aseCollect ion.getByI dentifier( 'no match' )).toBe(nu ll); | |
236 | }) ; | |
237 | }); | |
238 | ||
239 | descri be("Sub Ac tivityPaci ngCollecti on", funct ion () { | |
240 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
241 | activity PacingMode lReading = new VPC.M odel.PgdAc tivityPaci ng(), | |
242 | activity PacingMode lJogging = new VPC.M odel.PgdAc tivityPaci ng(), | |
243 | activity PacingColl ection = n ew VPC.Col lection.Pg dActivityP acings(); | |
244 | ac tivityPaci ngModelRea ding.set(' resource', pgdModels .activityP acingRespo nseReading ); | |
245 | ac tivityPaci ngModelJog ging.set(' resource', pgdModels .activityP acingRespo nseJogging ); | |
246 | ||
247 | it ('PGD SubA ctivityPac ingCollect ion compar ator funct ion should return so rt order', function () { | |
248 | expect(a ctivityPac ingCollect ion.compar ator(activ ityPacingM odelReadin g, activit yPacingMod elReading) ).toBe(0); | |
249 | expect(a ctivityPac ingCollect ion.compar ator(activ ityPacingM odelJoggin g, activit yPacingMod elReading) ).toBe(-1) ; | |
250 | expect(a ctivityPac ingCollect ion.compar ator(activ ityPacingM odelReadin g, activit yPacingMod elJogging) ).toBe(1); | |
251 | ||
252 | activity PacingColl ection.sor tDirection = -1; | |
253 | expect(a ctivityPac ingCollect ion.compar ator(activ ityPacingM odelReadin g, activit yPacingMod elReading) ).toBe(0); | |
254 | expect(a ctivityPac ingCollect ion.compar ator(activ ityPacingM odelJoggin g, activit yPacingMod elReading) ).toBe(1); | |
255 | expect(a ctivityPac ingCollect ion.compar ator(activ ityPacingM odelReadin g, activit yPacingMod elJogging) ).toBe(-1) ; | |
256 | }) ; | |
257 | }); | |
258 | ||
259 | descri be("Sub Mo nthlyAsses smentColle ction", fu nction () { | |
260 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
261 | monthlyA ssessments ModelHigh = new VPC. Model.PgdM onthlyAsse ssment(), | |
262 | monthlyA ssessments ModelLow = new VPC.M odel.PgdMo nthlyAsses sment(), | |
263 | monthlyA ssessments Collection = new VPC .Collectio n.PgdMonth lyAssessme nts(); | |
264 | mo nthlyAsses smentsMode lHigh.set( 'resource' , pgdModel s.monthlyA ssessmentR esponseHig h); | |
265 | mo nthlyAsses smentsMode lLow.set(' resource', pgdModels .monthlyAs sessmentRe sponseLow) ; | |
266 | ||
267 | it ('PGD SubM onthlyAsse ssmentsCol lection co mparator f unction sh ould retur n sort ord er', funct ion () { | |
268 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
269 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(-1); | |
270 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(1); | |
271 | ||
272 | monthlyA ssessments Collection .sortField = 'painIn terference '; | |
273 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
274 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(-1); | |
275 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(1); | |
276 | ||
277 | monthlyA ssessments Collection .sortField = 'depres sionScore' ; | |
278 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
279 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(-1); | |
280 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(1); | |
281 | ||
282 | monthlyA ssessments Collection .sortField = 'painIn tensity'; | |
283 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
284 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(-1); | |
285 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(1); | |
286 | ||
287 | monthlyA ssessments Collection .sortField = 'sleepQ uality'; | |
288 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
289 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(-1); | |
290 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(1); | |
291 | ||
292 | monthlyA ssessments Collection .sortField = 'pleasu reLevel'; | |
293 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
294 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(-1); | |
295 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(1); | |
296 | ||
297 | monthlyA ssessments Collection .sortField = 'overal lStatus'; | |
298 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
299 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(-1); | |
300 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(1); | |
301 | ||
302 | monthlyA ssessments Collection .sortDirec tion = 1; | |
303 | monthlyA ssessments Collection .sortField = 'lastUp dated'; | |
304 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
305 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(1); | |
306 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(-1); | |
307 | ||
308 | monthlyA ssessments Collection .sortField = 'painIn terference '; | |
309 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
310 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(1); | |
311 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(-1); | |
312 | ||
313 | monthlyA ssessments Collection .sortField = 'depres sionScore' ; | |
314 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
315 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(1); | |
316 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(-1); | |
317 | ||
318 | monthlyA ssessments Collection .sortField = 'painIn tensity'; | |
319 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
320 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(1); | |
321 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(-1); | |
322 | ||
323 | monthlyA ssessments Collection .sortField = 'sleepQ uality'; | |
324 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
325 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(1); | |
326 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(-1); | |
327 | ||
328 | monthlyA ssessments Collection .sortField = 'pleasu reLevel'; | |
329 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
330 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(1); | |
331 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(-1); | |
332 | ||
333 | monthlyA ssessments Collection .sortField = 'overal lStatus'; | |
334 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lHigh)).to Be(0); | |
335 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elHigh, mo nthlyAsses smentsMode lLow)).toB e(1); | |
336 | expect(m onthlyAsse ssmentsCol lection.co mparator(m onthlyAsse ssmentsMod elLow, mon thlyAssess mentsModel High)).toB e(-1); | |
337 | }) ; | |
338 | }); | |
339 | ||
340 | descri be("Sub Pa inDiaryCol lection", function ( ) { | |
341 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
342 | painDiar iesModelHi gh = new V PC.Model.P gdPainDiar y(), | |
343 | painDiar iesModelLo w = new VP C.Model.Pg dPainDiary (), | |
344 | painDiar iesCollect ion = new VPC.Collec tion.PgdPa inDiaries( ); | |
345 | pa inDiariesM odelHigh.s et('resour ce', pgdMo dels.pgdPa inDiaryHig h); | |
346 | pa inDiariesM odelLow.se t('resourc e', pgdMod els.pgdPai nDiaryLow) ; | |
347 | ||
348 | it ('PGD SubP ainDiaries Collection comparato r function should re turn sort order', fu nction () { | |
349 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel High)).toB e(0); | |
350 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel Low)).toBe (1); | |
351 | expect(p ainDiaries Collection .comparato r(painDiar iesModelLo w, painDia riesModelH igh)).toBe (-1); | |
352 | ||
353 | painDiar iesCollect ion.sortFi eld = 'pai nRating'; | |
354 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel High)).toB e(0); | |
355 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel Low)).toBe (-1); | |
356 | expect(p ainDiaries Collection .comparato r(painDiar iesModelLo w, painDia riesModelH igh)).toBe (1); | |
357 | ||
358 | painDiar iesCollect ion.sortFi eld = 'dep ressionLev el'; | |
359 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel High)).toB e(0); | |
360 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel Low)).toBe (-1); | |
361 | expect(p ainDiaries Collection .comparato r(painDiar iesModelLo w, painDia riesModelH igh)).toBe (1); | |
362 | ||
363 | painDiar iesCollect ion.sortDi rection = 1; | |
364 | painDiar iesCollect ion.sortFi eld = 'dat eCreated'; | |
365 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel High)).toB e(0); | |
366 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel Low)).toBe (-1); | |
367 | expect(p ainDiaries Collection .comparato r(painDiar iesModelLo w, painDia riesModelH igh)).toBe (1); | |
368 | ||
369 | painDiar iesCollect ion.sortFi eld = 'pai nRating'; | |
370 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel High)).toB e(0); | |
371 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel Low)).toBe (1); | |
372 | expect(p ainDiaries Collection .comparato r(painDiar iesModelLo w, painDia riesModelH igh)).toBe (-1); | |
373 | ||
374 | painDiar iesCollect ion.sortFi eld = 'dep ressionLev el'; | |
375 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel High)).toB e(0); | |
376 | expect(p ainDiaries Collection .comparato r(painDiar iesModelHi gh, painDi ariesModel Low)).toBe (1); | |
377 | expect(p ainDiaries Collection .comparato r(painDiar iesModelLo w, painDia riesModelH igh)).toBe (-1); | |
378 | }) ; | |
379 | }); | |
380 | ||
381 | descri be("Sub Qu estionnair esCollecti on", funct ion () { | |
382 | va r pgdModel s = getJSO NFixture(' pgdModels. json'), | |
383 | question nairesMode l = new VP C.Model.Pg dQuestionn aire(), | |
384 | question nairesColl ection = n ew VPC.Col lection.Pg dQuestionn aires(); | |
385 | qu estionnair esModel.se t('resourc e', pgdMod els.monthl yAssessmen tQuestionn aire); | |
386 | qu estionnair esCollecti on.add(que stionnaire sModel); | |
387 | ||
388 | it ('PGD SubQ uestionnai resCollect ion getQue stionnaire function should ret urn reques ted questi onnaire', function ( ) { | |
389 | expect(q uestionnai resCollect ion.getQue stionnaire ("4b30323b -19fe-4a68 -9f7e-11ae 6142f86f") ).toEqual( questionna iresModel) ; | |
390 | expect(q uestionnai resCollect ion.getQue stionnaire ("no match ing questi onnaire")) .toBe(null ); | |
391 | }) ; | |
392 | }); | |
393 | }); |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.