@@ -202,24 +202,28 @@ describe('/applicationForms', () => {
202
202
baseFieldShortCode : 'yearsOfWork' ,
203
203
position : 1 ,
204
204
label : 'Anni Worki' ,
205
+ instructions : 'Please enter the number of years of work.' ,
205
206
} ) ;
206
207
await createApplicationFormField ( db , null , {
207
208
applicationFormId : 3 ,
208
209
baseFieldShortCode : 'organizationName' ,
209
210
position : 2 ,
210
211
label : 'Org Nomen' ,
212
+ instructions : 'Please enter the name of the organization.' ,
211
213
} ) ;
212
214
await createApplicationFormField ( db , null , {
213
215
applicationFormId : 2 ,
214
216
baseFieldShortCode : 'organizationName' ,
215
217
position : 2 ,
216
218
label : 'Name of Organization' ,
219
+ instructions : 'Please enter the name of the organization.' ,
217
220
} ) ;
218
221
await createApplicationFormField ( db , null , {
219
222
applicationFormId : 2 ,
220
223
baseFieldShortCode : 'yearsOfWork' ,
221
224
position : 1 ,
222
225
label : 'Duration of work in years' ,
226
+ instructions : 'Please enter the number of years of work.' ,
223
227
} ) ;
224
228
const result = await request ( app )
225
229
. get ( '/applicationForms/2' )
@@ -290,12 +294,14 @@ describe('/applicationForms', () => {
290
294
baseFieldShortCode : 'organizationName' ,
291
295
position : 2 ,
292
296
label : 'Name of Organization' ,
297
+ instructions : 'Please enter the name of the organization.' ,
293
298
} ) ;
294
299
await createApplicationFormField ( db , null , {
295
300
applicationFormId : 1 ,
296
301
baseFieldShortCode : 'yearsOfWork' ,
297
302
position : 1 ,
298
303
label : 'Duration of work in years' ,
304
+ instructions : 'Please enter the number of years of work.' ,
299
305
} ) ;
300
306
const result = await request ( app )
301
307
. get ( '/applicationForms/1' )
@@ -320,6 +326,7 @@ describe('/applicationForms', () => {
320
326
} ,
321
327
position : 1 ,
322
328
label : 'Duration of work in years' ,
329
+ instructions : 'Please enter the number of years of work.' ,
323
330
createdAt : expectTimestamp ( ) ,
324
331
} ,
325
332
{
@@ -334,6 +341,84 @@ describe('/applicationForms', () => {
334
341
} ,
335
342
position : 2 ,
336
343
label : 'Name of Organization' ,
344
+ instructions : 'Please enter the name of the organization.' ,
345
+ createdAt : expectTimestamp ( ) ,
346
+ } ,
347
+ ] ,
348
+ createdAt : expectTimestamp ( ) ,
349
+ } ) ;
350
+ } ) ;
351
+ it ( 'returns an application form with its fields when the user has read access to the relevant funder, and the instructions are null' , async ( ) => {
352
+ const systemFunder = await loadSystemFunder ( db , null ) ;
353
+ const systemUser = await loadSystemUser ( db , null ) ;
354
+ const systemUserAuthContext = getAuthContext ( systemUser ) ;
355
+ const testUser = await loadTestUser ( ) ;
356
+ await createOrUpdateUserFunderPermission ( db , systemUserAuthContext , {
357
+ userKeycloakUserId : testUser . keycloakUserId ,
358
+ funderShortCode : systemFunder . shortCode ,
359
+ permission : Permission . VIEW ,
360
+ } ) ;
361
+ await createOpportunity ( db , null , {
362
+ title : 'Holiday opportunity 🎄' ,
363
+ funderShortCode : systemFunder . shortCode ,
364
+ } ) ;
365
+ await createApplicationForm ( db , null , {
366
+ opportunityId : 1 ,
367
+ } ) ;
368
+ await createTestBaseFields ( ) ;
369
+ await createApplicationFormField ( db , null , {
370
+ applicationFormId : 1 ,
371
+ baseFieldShortCode : 'organizationName' ,
372
+ position : 2 ,
373
+ label : 'Name of Organization' ,
374
+ instructions : null ,
375
+ } ) ;
376
+ await createApplicationFormField ( db , null , {
377
+ applicationFormId : 1 ,
378
+ baseFieldShortCode : 'yearsOfWork' ,
379
+ position : 1 ,
380
+ label : 'Duration of work in years' ,
381
+ instructions : null ,
382
+ } ) ;
383
+ const result = await request ( app )
384
+ . get ( '/applicationForms/1' )
385
+ . set ( authHeader )
386
+ . expect ( 200 ) ;
387
+
388
+ expect ( result . body ) . toMatchObject ( {
389
+ id : 1 ,
390
+ opportunityId : 1 ,
391
+ version : 1 ,
392
+ fields : [
393
+ {
394
+ applicationFormId : 1 ,
395
+ baseFieldShortCode : 'yearsOfWork' ,
396
+ baseField : {
397
+ label : 'Years of work' ,
398
+ description :
399
+ 'The number of years the project will take to complete' ,
400
+ shortCode : 'yearsOfWork' ,
401
+ dataType : BaseFieldDataType . STRING ,
402
+ createdAt : expectTimestamp ( ) ,
403
+ } ,
404
+ position : 1 ,
405
+ label : 'Duration of work in years' ,
406
+ instructions : null ,
407
+ createdAt : expectTimestamp ( ) ,
408
+ } ,
409
+ {
410
+ applicationFormId : 1 ,
411
+ baseFieldShortCode : 'organizationName' ,
412
+ baseField : {
413
+ label : 'Organization Name' ,
414
+ description : 'The organizational name of the applicant' ,
415
+ shortCode : 'organizationName' ,
416
+ dataType : BaseFieldDataType . STRING ,
417
+ createdAt : expectTimestamp ( ) ,
418
+ } ,
419
+ position : 2 ,
420
+ label : 'Name of Organization' ,
421
+ instructions : null ,
337
422
createdAt : expectTimestamp ( ) ,
338
423
} ,
339
424
] ,
@@ -365,6 +450,7 @@ describe('/applicationForms', () => {
365
450
baseFieldShortCode : forbiddenBaseField . shortCode ,
366
451
position : 1 ,
367
452
label : 'Anni Worki' ,
453
+ instructions : 'Please enter the number of years of work.' ,
368
454
} ) ;
369
455
await createOrUpdateBaseField ( db , null , {
370
456
...forbiddenBaseField ,
@@ -412,12 +498,14 @@ describe('/applicationForms', () => {
412
498
baseFieldShortCode : 'organizationName' ,
413
499
position : 2 ,
414
500
label : 'Name of Organization' ,
501
+ instructions : 'Please enter the name of the organization.' ,
415
502
} ) ;
416
503
await createApplicationFormField ( db , null , {
417
504
applicationFormId : 1 ,
418
505
baseFieldShortCode : 'yearsOfWork' ,
419
506
position : 1 ,
420
507
label : 'Duration of work in years' ,
508
+ instructions : 'Please enter the number of years of work.' ,
421
509
} ) ;
422
510
await request ( app ) . get ( '/applicationForms/1' ) . set ( authHeader ) . expect ( 404 ) ;
423
511
} ) ;
@@ -560,6 +648,7 @@ describe('/applicationForms', () => {
560
648
baseFieldShortCode : 'organizationName' ,
561
649
position : 1 ,
562
650
label : 'Organization Name' ,
651
+ instructions : 'Please enter the name of the organization.' ,
563
652
} ,
564
653
] ,
565
654
} )
@@ -578,6 +667,7 @@ describe('/applicationForms', () => {
578
667
createdAt : expectTimestamp ( ) ,
579
668
id : 1 ,
580
669
label : 'Organization Name' ,
670
+ instructions : 'Please enter the name of the organization.' ,
581
671
position : 1 ,
582
672
} ,
583
673
] ,
0 commit comments