@@ -433,6 +433,50 @@ func TestCreateCensusFilterOutputsPagination(t *testing.T) {
433
433
})
434
434
}
435
435
436
+ func TestCreateCensusFilterOutputsQualityNotices (t * testing.T ) {
437
+ helper .InitialiseLocalisationsHelper (mocks .MockAssetFunction )
438
+ req := httptest .NewRequest ("" , "/" , nil )
439
+ pageModel := coreModel.Page {}
440
+ contacts := getTestContacts ()
441
+ relatedContent := getTestRelatedContent ()
442
+ datasetModel := getTestDatasetDetails (contacts , relatedContent )
443
+ datasetModel .Type = "multivariate"
444
+ serviceMessage := getTestServiceMessage ()
445
+ emergencyBanner := getTestEmergencyBanner ()
446
+
447
+ Convey ("given a request for a filter outputs census landing page" , t , func () {
448
+ version := getTestVersionDetails (1 , getTestDefaultDimensions (), getTestDownloads ([]string {"xlsx" }), nil )
449
+ filterDims := []sharedModel.FilterDimension {getTestFilterDimension ("geography" , true , []string {"option 1" , "option 2" }, 2 ), getTestFilterDimension ("first" , false , []string {}, 2 ), getTestFilterDimension ("second" , false , []string {}, 2 )}
450
+ filterOutputs := filter.Model {
451
+ Downloads : getTestFilterDownloads ([]string {"xlsx" }),
452
+ }
453
+
454
+ Convey ("when there is a quality notice on the dimension" , func () {
455
+ filterDims [0 ].QualityStatementText = "This is a quality notice statement"
456
+ filterDims [0 ].QualitySummaryURL = "https://quality-notice-1.com"
457
+ filterDims [1 ].QualityStatementText = "This is another quality notice statement"
458
+ filterDims [1 ].QualitySummaryURL = "https://quality-notice-2.com"
459
+
460
+ page := CreateCensusFilterOutputsPage (context .Background (), req , pageModel , datasetModel , version , "" , false , []dataset.Version {version }, 1 , "/a/version/1" , "" , []string {}, 50 , false , true , filterOutputs , filterDims , serviceMessage , emergencyBanner , true , population.GetDimensionsResponse {}, cantabular.GetBlockedAreaCountResult {}, population.GetPopulationTypeResponse {})
461
+
462
+ Convey ("then the 'quality notice' panel is displayed" , func () {
463
+ mockPanel := []datasetLandingPageCensus.Panel {
464
+ {
465
+ Body : []string {"<p>This is a quality notice statement</p>Read more about this" },
466
+ CssClasses : []string {"ons-u-mt-no" },
467
+ },
468
+ {
469
+ Body : []string {"<p>This is another quality notice statement</p>Read more about this" },
470
+ CssClasses : []string {"ons-u-mt-no" , "ons-u-mb-l" },
471
+ },
472
+ }
473
+ So (page .DatasetLandingPage .QualityStatements , ShouldHaveLength , 2 )
474
+ So (page .DatasetLandingPage .QualityStatements , ShouldResemble , mockPanel )
475
+ })
476
+ })
477
+ })
478
+ }
479
+
436
480
func TestCreateCensusFilterOutputsAnalytics (t * testing.T ) {
437
481
Convey ("given we have changed area_type only" , t , func () {
438
482
filterDimensions := []sharedModel.FilterDimension {
0 commit comments