@studyportals/fawkes 8.7.0 → 8.7.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/organisations-seo/index.d.ts +3 -3
- package/dist/organisations-seo/index.js +1 -1
- package/dist/programmes-seo/index.d.ts +5 -5
- package/dist/programmes-seo/index.js +1 -1
- package/dist/scholarships-seo/index.d.ts +4 -4
- package/dist/scholarships-seo/index.js +2 -2
- package/dist/sitemap-generator-seo/index.d.ts +14 -14
- package/dist/sitemap-generator-seo/index.js +5 -5
- package/dist/src/common/IDependencies.d.ts +1 -1
- package/dist/src/common/IPresenter.d.ts +1 -1
- package/dist/src/common/ISearchDependencies.d.ts +1 -1
- package/dist/src/common/ISeoDependencies.d.ts +2 -2
- package/dist/src/common/ISitemapDependencies.d.ts +2 -2
- package/dist/src/common/ISitemapUrlGenerator.d.ts +1 -1
- package/dist/src/common/policies/BaseSeoIndexabilityPolicy.d.ts +1 -1
- package/dist/src/common/policies/BaseSeoIndexabilityPolicy.js +2 -2
- package/dist/src/common/rules/NoFiltersSelectedRule.d.ts +2 -2
- package/dist/src/common/rules/OnlineAttendanceRule.d.ts +1 -1
- package/dist/src/common/rules/OnlineAttendanceRule.js +1 -1
- package/dist/src/common/rules/OnlyFiltersSelectedRule.d.ts +2 -2
- package/dist/src/common/rules/SingleValueSelectedForFilterRule.d.ts +2 -2
- package/dist/src/organisations/IOrganisationSearchApplicationState.d.ts +1 -1
- package/dist/src/organisations/ISeoSortingState.d.ts +1 -1
- package/dist/src/organisations/SearchIndexabilityManager.d.ts +4 -4
- package/dist/src/organisations/SearchIndexabilityManager.js +2 -2
- package/dist/src/organisations/policies/OrganisationsSeoIndexabilityPolicy.d.ts +3 -3
- package/dist/src/organisations/policies/OrganisationsSeoIndexabilityPolicy.js +3 -3
- package/dist/src/organisations/policies/RankedOrganisationsSeoIndexabilityPolicy.d.ts +1 -1
- package/dist/src/organisations/policies/RankedOrganisationsSeoIndexabilityPolicy.js +1 -1
- package/dist/src/organisations/policies/our-picks/Area.d.ts +5 -5
- package/dist/src/organisations/policies/our-picks/Area.js +6 -6
- package/dist/src/organisations/policies/our-picks/AreaAttendance.d.ts +7 -7
- package/dist/src/organisations/policies/our-picks/AreaAttendance.js +9 -9
- package/dist/src/organisations/policies/our-picks/Attendance.d.ts +6 -6
- package/dist/src/organisations/policies/our-picks/Attendance.js +7 -7
- package/dist/src/organisations/policies/our-picks/Continent.d.ts +5 -5
- package/dist/src/organisations/policies/our-picks/Continent.js +6 -6
- package/dist/src/organisations/policies/our-picks/Country.d.ts +5 -5
- package/dist/src/organisations/policies/our-picks/Country.js +6 -6
- package/dist/src/organisations/policies/our-picks/CountryAreaCity.d.ts +6 -6
- package/dist/src/organisations/policies/our-picks/CountryAreaCity.js +7 -7
- package/dist/src/organisations/policies/our-picks/CountryAttendance.d.ts +7 -7
- package/dist/src/organisations/policies/our-picks/CountryAttendance.js +9 -9
- package/dist/src/organisations/policies/our-picks/CountryCity.d.ts +6 -6
- package/dist/src/organisations/policies/our-picks/CountryCity.js +7 -7
- package/dist/src/organisations/policies/our-picks/Unfiltered.d.ts +4 -4
- package/dist/src/organisations/policies/our-picks/Unfiltered.js +4 -4
- package/dist/src/organisations/policies/ranked/RankedArea.d.ts +4 -4
- package/dist/src/organisations/policies/ranked/RankedArea.js +4 -4
- package/dist/src/organisations/policies/ranked/RankedAreaDiscipline.d.ts +5 -5
- package/dist/src/organisations/policies/ranked/RankedAreaDiscipline.js +6 -6
- package/dist/src/organisations/policies/ranked/RankedAttendance.d.ts +5 -5
- package/dist/src/organisations/policies/ranked/RankedAttendance.js +5 -5
- package/dist/src/organisations/policies/ranked/RankedAttendanceDiscipline.d.ts +5 -5
- package/dist/src/organisations/policies/ranked/RankedAttendanceDiscipline.js +6 -6
- package/dist/src/organisations/policies/ranked/RankedContinent.d.ts +4 -4
- package/dist/src/organisations/policies/ranked/RankedContinent.js +4 -4
- package/dist/src/organisations/policies/ranked/RankedContinentAttendance.d.ts +6 -6
- package/dist/src/organisations/policies/ranked/RankedContinentAttendance.js +7 -7
- package/dist/src/organisations/policies/ranked/RankedCountry.d.ts +4 -4
- package/dist/src/organisations/policies/ranked/RankedCountry.js +4 -4
- package/dist/src/organisations/policies/ranked/RankedCountryAttendance.d.ts +5 -5
- package/dist/src/organisations/policies/ranked/RankedCountryAttendance.js +6 -6
- package/dist/src/organisations/policies/ranked/RankedCountryDiscipline.d.ts +4 -4
- package/dist/src/organisations/policies/ranked/RankedCountryDiscipline.js +5 -5
- package/dist/src/organisations/policies/ranked/RankedDiscipline.d.ts +4 -4
- package/dist/src/organisations/policies/ranked/RankedDiscipline.js +4 -4
- package/dist/src/organisations/policies/ranked/RankedUnfiltered.d.ts +3 -3
- package/dist/src/organisations/policies/ranked/RankedUnfiltered.js +2 -2
- package/dist/src/organisations/rules/BaseSearchVolumeOrganisationsRule.d.ts +3 -3
- package/dist/src/organisations/rules/ContinentIsEuropeRule.d.ts +1 -1
- package/dist/src/organisations/rules/ContinentIsEuropeRule.js +1 -1
- package/dist/src/organisations/rules/ExcludeByIdForCitiesRule.d.ts +3 -3
- package/dist/src/organisations/rules/MinimumAmountOfRankedResultsRule.d.ts +3 -3
- package/dist/src/organisations/rules/MinimumAmountOfRankedResultsRule.js +1 -1
- package/dist/src/organisations/rules/MinimumAmountOfResultsRule.d.ts +4 -4
- package/dist/src/organisations/rules/MinimumAmountOfResultsRule.js +1 -1
- package/dist/src/organisations/rules/NoFiltersSelectedRule.d.ts +2 -2
- package/dist/src/organisations/types/IOrganisationSearchDependencies.d.ts +2 -2
- package/dist/src/organisations/types/IOrganisationsSitemapDependencies.d.ts +3 -3
- package/dist/src/presenters/AreaPresenter.d.ts +1 -1
- package/dist/src/presenters/AttendancePresenter.d.ts +1 -1
- package/dist/src/presenters/CityPresenter.d.ts +1 -1
- package/dist/src/presenters/ContinentPresenter.d.ts +1 -1
- package/dist/src/presenters/CountryPresenter.d.ts +1 -1
- package/dist/src/presenters/DegreePresenter.d.ts +1 -1
- package/dist/src/presenters/DisciplinePresenter.d.ts +1 -1
- package/dist/src/presenters/DurationPresenter.d.ts +1 -1
- package/dist/src/presenters/EducationalFormPresenter.d.ts +1 -1
- package/dist/src/presenters/FormatPresenter.d.ts +1 -1
- package/dist/src/presenters/SpecialProgrammesPresenter.d.ts +1 -1
- package/dist/src/presenters/TuitionFeePresenter.d.ts +1 -1
- package/dist/src/programmes/BaseProgrammeFilterKeyValueRule.d.ts +2 -2
- package/dist/src/programmes/BaseProgrammeFilterKeyValueRule.js +1 -1
- package/dist/src/programmes/BaseProgrammeRule.d.ts +2 -2
- package/dist/src/programmes/IProgrammeRule.d.ts +2 -2
- package/dist/src/programmes/ProgrammesBaseIndexabilityPolicy.d.ts +3 -3
- package/dist/src/programmes/ProgrammesBaseIndexabilityPolicy.js +1 -1
- package/dist/src/programmes/SearchIndexabilityManager.d.ts +4 -4
- package/dist/src/programmes/SearchIndexabilityManager.js +8 -4
- package/dist/src/programmes/policies/Area.d.ts +3 -3
- package/dist/src/programmes/policies/Area.js +4 -4
- package/dist/src/programmes/policies/Attendance.d.ts +4 -4
- package/dist/src/programmes/policies/Attendance.js +5 -5
- package/dist/src/programmes/policies/AttendanceArea.d.ts +4 -4
- package/dist/src/programmes/policies/AttendanceArea.js +6 -6
- package/dist/src/programmes/policies/AttendanceContinent.d.ts +4 -4
- package/dist/src/programmes/policies/AttendanceContinent.js +6 -6
- package/dist/src/programmes/policies/AttendanceDegree.d.ts +2 -2
- package/dist/src/programmes/policies/AttendanceDegree.js +5 -5
- package/dist/src/programmes/policies/AttendanceDuration.d.ts +5 -5
- package/dist/src/programmes/policies/AttendanceDuration.js +7 -7
- package/dist/src/programmes/policies/AttendanceFormat.d.ts +4 -4
- package/dist/src/programmes/policies/AttendanceFormat.js +6 -6
- package/dist/src/programmes/policies/Continent.d.ts +3 -3
- package/dist/src/programmes/policies/Continent.js +4 -4
- package/dist/src/programmes/policies/ContinentDuration.d.ts +3 -3
- package/dist/src/programmes/policies/ContinentDuration.js +5 -5
- package/dist/src/programmes/policies/ContinentFormat.d.ts +3 -3
- package/dist/src/programmes/policies/ContinentFormat.js +5 -5
- package/dist/src/programmes/policies/ContinentSpecialProgrammes.d.ts +4 -4
- package/dist/src/programmes/policies/ContinentSpecialProgrammes.js +6 -6
- package/dist/src/programmes/policies/Country.d.ts +3 -3
- package/dist/src/programmes/policies/Country.js +4 -4
- package/dist/src/programmes/policies/CountryAttendance.d.ts +4 -4
- package/dist/src/programmes/policies/CountryAttendance.js +6 -6
- package/dist/src/programmes/policies/CountryAttendanceDegree.d.ts +4 -4
- package/dist/src/programmes/policies/CountryAttendanceDegree.js +7 -7
- package/dist/src/programmes/policies/CountryDegree.d.ts +2 -2
- package/dist/src/programmes/policies/CountryDegree.js +5 -5
- package/dist/src/programmes/policies/CountryDuration.d.ts +3 -3
- package/dist/src/programmes/policies/CountryDuration.js +5 -5
- package/dist/src/programmes/policies/CountryDurationDegree.d.ts +3 -3
- package/dist/src/programmes/policies/CountryDurationDegree.js +6 -6
- package/dist/src/programmes/policies/CountryEducationalForm.d.ts +2 -2
- package/dist/src/programmes/policies/CountryEducationalForm.js +5 -5
- package/dist/src/programmes/policies/CountryFormat.d.ts +3 -3
- package/dist/src/programmes/policies/CountryFormat.js +5 -5
- package/dist/src/programmes/policies/CountrySpecialProgrammes.d.ts +4 -4
- package/dist/src/programmes/policies/CountrySpecialProgrammes.js +6 -6
- package/dist/src/programmes/policies/Degree.d.ts +3 -3
- package/dist/src/programmes/policies/Degree.js +4 -4
- package/dist/src/programmes/policies/DegreeArea.d.ts +3 -3
- package/dist/src/programmes/policies/DegreeArea.js +5 -5
- package/dist/src/programmes/policies/DegreeAttendanceDiscipline.d.ts +4 -4
- package/dist/src/programmes/policies/DegreeAttendanceDiscipline.js +7 -7
- package/dist/src/programmes/policies/DegreeAttendanceFormat.d.ts +4 -4
- package/dist/src/programmes/policies/DegreeAttendanceFormat.js +7 -7
- package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.d.ts +4 -4
- package/dist/src/programmes/policies/DegreeAttendanceSpecialProgrammes.js +7 -7
- package/dist/src/programmes/policies/DegreeContinent.d.ts +2 -2
- package/dist/src/programmes/policies/DegreeContinent.js +5 -5
- package/dist/src/programmes/policies/DegreeCountryAttendance.d.ts +3 -3
- package/dist/src/programmes/policies/DegreeCountryAttendance.js +6 -6
- package/dist/src/programmes/policies/DegreeCountryDiscipline.d.ts +3 -3
- package/dist/src/programmes/policies/DegreeCountryDiscipline.js +6 -6
- package/dist/src/programmes/policies/DegreeCountryTuitionFee.d.ts +3 -3
- package/dist/src/programmes/policies/DegreeCountryTuitionFee.js +6 -6
- package/dist/src/programmes/policies/DegreeDuration.d.ts +2 -2
- package/dist/src/programmes/policies/DegreeDuration.js +5 -5
- package/dist/src/programmes/policies/DegreeFormat.d.ts +2 -2
- package/dist/src/programmes/policies/DegreeFormat.js +5 -5
- package/dist/src/programmes/policies/DegreeSpecialProgrammes.d.ts +3 -3
- package/dist/src/programmes/policies/DegreeSpecialProgrammes.js +5 -5
- package/dist/src/programmes/policies/DegreeTuitionFee.d.ts +3 -3
- package/dist/src/programmes/policies/DegreeTuitionFee.js +5 -5
- package/dist/src/programmes/policies/{DisciplineTuitionFee.d.ts → DegreeTuitionFeeArea.d.ts} +5 -5
- package/dist/src/programmes/policies/{DegreeAreaTuitionFee.js → DegreeTuitionFeeArea.js} +7 -7
- package/dist/src/programmes/policies/{DegreeAttendanceTuitionFee.d.ts → DegreeTuitionFeeAttendance.d.ts} +2 -2
- package/dist/src/programmes/policies/{DegreeAttendanceTuitionFee.js → DegreeTuitionFeeAttendance.js} +7 -7
- package/dist/src/programmes/policies/{DegreeContinentTuitionFee.d.ts → DegreeTuitionFeeContinent.d.ts} +2 -2
- package/dist/src/programmes/policies/{DegreeContinentTuitionFee.js → DegreeTuitionFeeContinent.js} +6 -6
- package/dist/src/programmes/policies/{DegreeFormatTuitionFee.d.ts → DegreeTuitionFeeFormat.d.ts} +3 -3
- package/dist/src/programmes/policies/{DegreeFormatTuitionFee.js → DegreeTuitionFeeFormat.js} +9 -9
- package/dist/src/programmes/policies/Discipline.d.ts +3 -3
- package/dist/src/programmes/policies/Discipline.js +4 -4
- package/dist/src/programmes/policies/DisciplineAttendance.d.ts +4 -4
- package/dist/src/programmes/policies/DisciplineAttendance.js +6 -6
- package/dist/src/programmes/policies/DisciplineContinent.d.ts +3 -3
- package/dist/src/programmes/policies/DisciplineContinent.js +5 -5
- package/dist/src/programmes/policies/DisciplineContinentAttendance.d.ts +4 -4
- package/dist/src/programmes/policies/DisciplineContinentAttendance.js +7 -7
- package/dist/src/programmes/policies/DisciplineCountry.d.ts +3 -3
- package/dist/src/programmes/policies/DisciplineCountry.js +5 -5
- package/dist/src/programmes/policies/DisciplineCountryAttendance.d.ts +4 -4
- package/dist/src/programmes/policies/DisciplineCountryAttendance.js +7 -7
- package/dist/src/programmes/policies/DisciplineCountryEducationalForm.d.ts +2 -2
- package/dist/src/programmes/policies/DisciplineCountryEducationalForm.js +6 -6
- package/dist/src/programmes/policies/DisciplineCountryFormat.d.ts +3 -3
- package/dist/src/programmes/policies/DisciplineCountryFormat.js +6 -6
- package/dist/src/programmes/policies/DisciplineDegree.d.ts +3 -3
- package/dist/src/programmes/policies/DisciplineDegree.js +5 -5
- package/dist/src/programmes/policies/DisciplineDuration.d.ts +3 -3
- package/dist/src/programmes/policies/DisciplineDuration.js +5 -5
- package/dist/src/programmes/policies/DisciplineEducationalForm.d.ts +2 -2
- package/dist/src/programmes/policies/DisciplineEducationalForm.js +5 -5
- package/dist/src/programmes/policies/DisciplineFormat.d.ts +3 -3
- package/dist/src/programmes/policies/DisciplineFormat.js +5 -5
- package/dist/src/programmes/policies/DisciplineSpecialProgrammes.d.ts +3 -3
- package/dist/src/programmes/policies/DisciplineSpecialProgrammes.js +5 -5
- package/dist/src/programmes/policies/Duration.d.ts +3 -3
- package/dist/src/programmes/policies/Duration.js +4 -4
- package/dist/src/programmes/policies/Format.d.ts +3 -3
- package/dist/src/programmes/policies/Format.js +4 -4
- package/dist/src/programmes/policies/SpecialProgrammes.d.ts +3 -3
- package/dist/src/programmes/policies/SpecialProgrammes.js +4 -4
- package/dist/src/programmes/policies/TuitionFee.d.ts +3 -3
- package/dist/src/programmes/policies/TuitionFee.js +4 -4
- package/dist/src/programmes/policies/TuitionFeeAttendance.d.ts +4 -4
- package/dist/src/programmes/policies/TuitionFeeAttendance.js +6 -6
- package/dist/src/programmes/policies/TuitionFeeAttendanceDiscipline.d.ts +4 -4
- package/dist/src/programmes/policies/TuitionFeeAttendanceDiscipline.js +7 -7
- package/dist/src/programmes/policies/TuitionFeeContinent.d.ts +3 -3
- package/dist/src/programmes/policies/TuitionFeeContinent.js +5 -5
- package/dist/src/programmes/policies/TuitionFeeCountry.d.ts +3 -3
- package/dist/src/programmes/policies/TuitionFeeCountry.js +5 -5
- package/dist/src/programmes/policies/TuitionFeeDiscipline.d.ts +3 -3
- package/dist/src/programmes/policies/TuitionFeeDiscipline.js +5 -5
- package/dist/src/programmes/policies/Unfiltered.d.ts +2 -2
- package/dist/src/programmes/policies/Unfiltered.js +2 -2
- package/dist/src/programmes/policies/index.d.ts +4 -5
- package/dist/src/programmes/policies/index.js +4 -5
- package/dist/src/programmes/rules/DegreeAttendanceDisciplineRule.d.ts +2 -2
- package/dist/src/programmes/rules/DegreeAttendanceDisciplineSpecificRule.d.ts +2 -2
- package/dist/src/programmes/rules/DegreeCountryAttendanceSpecificRule.d.ts +2 -2
- package/dist/src/programmes/rules/DegreeCountryDisciplineSpecificRule.d.ts +2 -2
- package/dist/src/programmes/rules/DegreeCountryTuitionFeeSpecificRule.d.ts +2 -2
- package/dist/src/programmes/rules/DegreeDisciplineRule.d.ts +2 -2
- package/dist/src/programmes/rules/IndexableDegreeRule.d.ts +2 -2
- package/dist/src/programmes/rules/IndexableDegreeRule.js +1 -1
- package/dist/src/programmes/rules/IndexableDurationRule.d.ts +2 -2
- package/dist/src/programmes/rules/IndexableDurationRule.js +1 -1
- package/dist/src/programmes/rules/IndexableEducationalFormRule.d.ts +2 -2
- package/dist/src/programmes/rules/IndexableEducationalFormRule.js +1 -1
- package/dist/src/programmes/rules/IndexablePageNumberRule.js +1 -1
- package/dist/src/programmes/rules/MbaOrMscDegreeRule.d.ts +2 -2
- package/dist/src/programmes/rules/MinimumAmountOfResultsRule.d.ts +3 -3
- package/dist/src/programmes/rules/MinimumAmountOfResultsRule.js +1 -1
- package/dist/src/programmes/rules/NotDistanceLearningPortalRule.js +1 -1
- package/dist/src/programmes/rules/OneYearOnlyRule.d.ts +2 -2
- package/dist/src/programmes/types/IProgrammeSearchApplicationState.d.ts +1 -1
- package/dist/src/programmes/types/IProgrammeSearchDependencies.d.ts +1 -1
- package/dist/src/programmes/types/IProgrammeSearchSitemapDependencies.d.ts +1 -1
- package/dist/src/programmes/types/IProgrammeSitemapDependencies.d.ts +2 -2
- package/dist/src/programmes/types/IProgrammeSitemapUrlGenerator.d.ts +1 -1
- package/dist/src/scholarships/SearchIndexabilityManager.d.ts +5 -5
- package/dist/src/scholarships/SearchIndexabilityManager.js +1 -1
- package/dist/src/scholarships/policies/Area.d.ts +3 -3
- package/dist/src/scholarships/policies/Area.js +4 -4
- package/dist/src/scholarships/policies/Country.d.ts +3 -3
- package/dist/src/scholarships/policies/Country.js +4 -4
- package/dist/src/scholarships/policies/Discipline.d.ts +4 -4
- package/dist/src/scholarships/policies/Discipline.js +5 -5
- package/dist/src/scholarships/policies/DisciplineCountry.d.ts +3 -3
- package/dist/src/scholarships/policies/DisciplineCountry.js +5 -5
- package/dist/src/scholarships/policies/ScholarshipSeoIndexabilityPolicy.d.ts +2 -2
- package/dist/src/scholarships/policies/ScholarshipSeoIndexabilityPolicy.js +2 -2
- package/dist/src/scholarships/policies/Unfiltered.d.ts +2 -2
- package/dist/src/scholarships/policies/Unfiltered.js +2 -2
- package/dist/src/scholarships/policies/UniversityCountry.d.ts +3 -3
- package/dist/src/scholarships/policies/UniversityCountry.js +4 -4
- package/dist/src/scholarships/rules/ExceptAustaliaAreasRule.d.ts +3 -3
- package/dist/src/scholarships/rules/ExceptAustaliaAreasRule.js +1 -1
- package/dist/src/scholarships/rules/SearchVolumeAreasRule.d.ts +3 -3
- package/dist/src/scholarships/rules/SearchVolumeCountriesDisciplinesRule.d.ts +3 -3
- package/dist/src/scholarships/rules/SearchVolumeCountriesRule.d.ts +3 -3
- package/dist/src/scholarships/rules/SearchVolumeDisciplinesRule.d.ts +3 -3
- package/dist/src/scholarships/types/IScholarshipSeoDependencies.d.ts +1 -1
- package/dist/src/scholarships/types/IScholarshipSitemapDependencies.d.ts +2 -2
- package/dist/src/sitemap-generator/BaseSitemapUrlGeneratorManager.d.ts +3 -3
- package/dist/src/sitemap-generator/IRankingApiClient.d.ts +1 -1
- package/dist/src/sitemap-generator/ISearchApiClient.d.ts +1 -1
- package/dist/src/sitemap-generator/ISitemapUrlGeneratorManager.d.ts +3 -3
- package/dist/src/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.d.ts +4 -4
- package/dist/src/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.js +8 -8
- package/dist/src/sitemap-generator/ProgrammesSitemapUrlGeneratorManager.d.ts +3 -3
- package/dist/src/sitemap-generator/ProgrammesSitemapUrlGeneratorManager.js +15 -15
- package/dist/src/sitemap-generator/ScholarshipsSitemapUrlGeneratorManager.d.ts +3 -3
- package/dist/src/sitemap-generator/ScholarshipsSitemapUrlGeneratorManager.js +7 -7
- package/dist/src/structured-data/OrganisationStructuredDataFactory.d.ts +1 -1
- package/dist/src/structured-data/ProgrammeStructuredDataFactory.d.ts +1 -1
- package/dist/tests/common/rules/NoFiltersSelectedRule.test.d.mts +1 -0
- package/dist/tests/common/rules/NoFiltersSelectedRule.test.mjs +40 -0
- package/dist/tests/common/rules/OnlyFiltersSelectedRule.test.d.mts +1 -0
- package/dist/tests/common/rules/OnlyFiltersSelectedRule.test.mjs +70 -0
- package/dist/tests/common/rules/SingleValueSelectedForFilterRule.test.d.mts +1 -0
- package/dist/tests/common/rules/SingleValueSelectedForFilterRule.test.mjs +54 -0
- package/dist/tests/organisations/policies/our-picks/Area.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/Area.test.mjs +125 -0
- package/dist/tests/organisations/policies/our-picks/AreaAttendance.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/AreaAttendance.test.mjs +238 -0
- package/dist/tests/organisations/policies/our-picks/Attendance.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/Attendance.test.mjs +119 -0
- package/dist/tests/organisations/policies/our-picks/Continent.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/Continent.test.mjs +105 -0
- package/dist/tests/organisations/policies/our-picks/Country.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/Country.test.mjs +109 -0
- package/dist/tests/organisations/policies/our-picks/CountryAreaCity.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/CountryAreaCity.test.mjs +152 -0
- package/dist/tests/organisations/policies/our-picks/CountryAttendance.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/CountryAttendance.test.mjs +223 -0
- package/dist/tests/organisations/policies/our-picks/CountryCity.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/CountryCity.test.mjs +109 -0
- package/dist/tests/organisations/policies/our-picks/Unfiltered.test.d.mts +1 -0
- package/dist/tests/organisations/policies/our-picks/Unfiltered.test.mjs +60 -0
- package/dist/tests/organisations/policies/ranked/RankedArea.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedArea.test.mjs +149 -0
- package/dist/tests/organisations/policies/ranked/RankedAreaDiscipline.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedAreaDiscipline.test.mjs +237 -0
- package/dist/tests/organisations/policies/ranked/RankedAttendance.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedAttendance.test.mjs +139 -0
- package/dist/tests/organisations/policies/ranked/RankedAttendanceDiscipline.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedAttendanceDiscipline.test.mjs +224 -0
- package/dist/tests/organisations/policies/ranked/RankedContinent.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedContinent.test.mjs +125 -0
- package/dist/tests/organisations/policies/ranked/RankedContinentAttendance.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedContinentAttendance.test.mjs +253 -0
- package/dist/tests/organisations/policies/ranked/RankedCountry.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedCountry.test.mjs +131 -0
- package/dist/tests/organisations/policies/ranked/RankedCountryAttendance.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedCountryAttendance.test.mjs +230 -0
- package/dist/tests/organisations/policies/ranked/RankedCountryDiscipline.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedCountryDiscipline.test.mjs +197 -0
- package/dist/tests/organisations/policies/ranked/RankedDiscipline.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedDiscipline.test.mjs +124 -0
- package/dist/tests/organisations/policies/ranked/RankedUnfiltered.test.d.mts +1 -0
- package/dist/tests/organisations/policies/ranked/RankedUnfiltered.test.mjs +75 -0
- package/dist/tests/organisations/rules/ContinentIsEuropeRule.test.d.mts +1 -0
- package/dist/tests/organisations/rules/ContinentIsEuropeRule.test.mjs +59 -0
- package/dist/tests/organisations/rules/MinimumAmountOfRankedResultsRule.test.d.mts +1 -0
- package/dist/tests/organisations/rules/MinimumAmountOfRankedResultsRule.test.mjs +77 -0
- package/dist/tests/organisations/rules/MinimumAmountOfResultsRule.test.d.mts +1 -0
- package/dist/tests/organisations/rules/MinimumAmountOfResultsRule.test.mjs +77 -0
- package/dist/tests/organisations/rules/OnlineAttendanceRule.test.d.mts +1 -0
- package/dist/tests/organisations/rules/OnlineAttendanceRule.test.mjs +59 -0
- package/dist/tests/organisations/rules/SearchVolumeAreasAttendanceRule.test.d.mts +1 -0
- package/dist/tests/organisations/rules/SearchVolumeAreasAttendanceRule.test.mjs +59 -0
- package/dist/tests/organisations/rules/SearchVolumeAreasDisciplineRule.test.d.mts +1 -0
- package/dist/tests/organisations/rules/SearchVolumeAreasDisciplineRule.test.mjs +59 -0
- package/dist/tests/organisations/rules/SearchVolumeCountriesAttendanceRule.test.d.mts +1 -0
- package/dist/tests/organisations/rules/SearchVolumeCountriesAttendanceRule.test.mjs +59 -0
- package/dist/tests/organisations/utils/SearchDependencies.util.d.mts +20 -0
- package/dist/tests/organisations/utils/SearchDependencies.util.mjs +88 -0
- package/dist/tests/organisations/utils/SitemapDependencies.util.d.mts +18 -0
- package/dist/tests/organisations/utils/SitemapDependencies.util.mjs +54 -0
- package/dist/tests/presenters/AreaPresenter.test.d.mts +1 -0
- package/dist/tests/presenters/AreaPresenter.test.mjs +46 -0
- package/dist/tests/presenters/AttendancePresenter.test.d.mts +1 -0
- package/dist/tests/presenters/AttendancePresenter.test.mjs +41 -0
- package/dist/tests/presenters/ContinentPresenter.test.d.mts +1 -0
- package/dist/tests/presenters/ContinentPresenter.test.mjs +44 -0
- package/dist/tests/presenters/CountryPresenter.test.d.mts +1 -0
- package/dist/tests/presenters/CountryPresenter.test.mjs +50 -0
- package/dist/tests/presenters/DegreePresenter.test.d.mts +1 -0
- package/dist/tests/presenters/DegreePresenter.test.mjs +51 -0
- package/dist/tests/presenters/DisciplinePresenter.test.d.mts +1 -0
- package/dist/tests/presenters/DisciplinePresenter.test.mjs +40 -0
- package/dist/tests/presenters/DurationPresenter.test.d.mts +1 -0
- package/dist/tests/presenters/DurationPresenter.test.mjs +64 -0
- package/dist/tests/presenters/EducationalFormPresenter.test.d.mts +1 -0
- package/dist/tests/presenters/EducationalFormPresenter.test.mjs +60 -0
- package/dist/tests/presenters/FormatPresenter.test.d.mts +1 -0
- package/dist/tests/presenters/FormatPresenter.test.mjs +43 -0
- package/dist/tests/presenters/SpecialProgrammesPresenter.test.d.mts +1 -0
- package/dist/tests/presenters/SpecialProgrammesPresenter.test.mjs +66 -0
- package/dist/tests/presenters/TuitionFeePresenter.test.d.mts +1 -0
- package/dist/tests/presenters/TuitionFeePresenter.test.mjs +52 -0
- package/dist/tests/programmes/policies/Area.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Area.test.mjs +153 -0
- package/dist/tests/programmes/policies/Attendance.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Attendance.test.mjs +173 -0
- package/dist/tests/programmes/policies/AttendanceDegree.test.d.mts +1 -0
- package/dist/tests/programmes/policies/AttendanceDegree.test.mjs +291 -0
- package/dist/tests/programmes/policies/Continent.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Continent.test.mjs +169 -0
- package/dist/tests/programmes/policies/Country.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Country.test.mjs +164 -0
- package/dist/tests/programmes/policies/CountryAttendance.test.d.mts +1 -0
- package/dist/tests/programmes/policies/CountryAttendance.test.mjs +251 -0
- package/dist/tests/programmes/policies/CountryAttendanceDegree.test.d.mts +1 -0
- package/dist/tests/programmes/policies/CountryAttendanceDegree.test.mjs +337 -0
- package/dist/tests/programmes/policies/CountryDegree.test.d.mts +1 -0
- package/dist/tests/programmes/policies/CountryDegree.test.mjs +262 -0
- package/dist/tests/programmes/policies/CountryDuration.test.d.mts +1 -0
- package/dist/tests/programmes/policies/CountryDuration.test.mjs +234 -0
- package/dist/tests/programmes/policies/CountryDurationDegree.test.d.mts +1 -0
- package/dist/tests/programmes/policies/CountryDurationDegree.test.mjs +304 -0
- package/dist/tests/programmes/policies/CountryEducationalForm.test.d.mts +1 -0
- package/dist/tests/programmes/policies/CountryEducationalForm.test.mjs +260 -0
- package/dist/tests/programmes/policies/CountryFormat.test.d.mts +1 -0
- package/dist/tests/programmes/policies/CountryFormat.test.mjs +253 -0
- package/dist/tests/programmes/policies/DegreeAttendanceDiscipline.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DegreeAttendanceDiscipline.test.mjs +179 -0
- package/dist/tests/programmes/policies/DegreeCountryAttendance.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DegreeCountryAttendance.test.mjs +267 -0
- package/dist/tests/programmes/policies/DegreeCountryTuitionFee.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DegreeCountryTuitionFee.test.mjs +217 -0
- package/dist/tests/programmes/policies/DegreeFormat.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DegreeFormat.test.mjs +221 -0
- package/dist/tests/programmes/policies/Discipline.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Discipline.test.mjs +159 -0
- package/dist/tests/programmes/policies/DisciplineAttendance.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineAttendance.test.mjs +292 -0
- package/dist/tests/programmes/policies/DisciplineContinent.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineContinent.test.mjs +253 -0
- package/dist/tests/programmes/policies/DisciplineCountry.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineCountry.test.mjs +244 -0
- package/dist/tests/programmes/policies/DisciplineCountryEducationalForm.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineCountryEducationalForm.test.mjs +345 -0
- package/dist/tests/programmes/policies/DisciplineDegree.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineDegree.test.mjs +273 -0
- package/dist/tests/programmes/policies/DisciplineDuration.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineDuration.test.mjs +278 -0
- package/dist/tests/programmes/policies/DisciplineEducationalForm.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineEducationalForm.test.mjs +302 -0
- package/dist/tests/programmes/policies/DisciplineFormat.test.d.mts +1 -0
- package/dist/tests/programmes/policies/DisciplineFormat.test.mjs +266 -0
- package/dist/tests/programmes/policies/Duration.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Duration.test.mjs +179 -0
- package/dist/tests/programmes/policies/Format.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Format.test.mjs +117 -0
- package/dist/tests/programmes/policies/NewRulesValidation.test.d.mts +1 -0
- package/dist/tests/programmes/policies/NewRulesValidation.test.mjs +320 -0
- package/dist/tests/programmes/policies/SpecialProgrammes.test.d.mts +1 -0
- package/dist/tests/programmes/policies/SpecialProgrammes.test.mjs +171 -0
- package/dist/tests/programmes/policies/TuitionFeeAttendanceDiscipline.test.d.mts +1 -0
- package/dist/tests/programmes/policies/TuitionFeeAttendanceDiscipline.test.mjs +360 -0
- package/dist/tests/programmes/policies/TuitionFeeContinent.test.d.mts +1 -0
- package/dist/tests/programmes/policies/TuitionFeeContinent.test.mjs +293 -0
- package/dist/tests/programmes/policies/TuitionFeeCountry.test.d.mts +1 -0
- package/dist/tests/programmes/policies/TuitionFeeCountry.test.mjs +266 -0
- package/dist/tests/programmes/policies/TuitionFeeDiscipline.test.d.mts +1 -0
- package/dist/tests/programmes/policies/TuitionFeeDiscipline.test.mjs +267 -0
- package/dist/tests/programmes/policies/Unfiltered.test.d.mts +1 -0
- package/dist/tests/programmes/policies/Unfiltered.test.mjs +90 -0
- package/dist/tests/programmes/rules/AffordableTuitionFeeRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/AffordableTuitionFeeRule.test.mjs +27 -0
- package/dist/tests/programmes/rules/DegreeCountrySpecificRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/DegreeCountrySpecificRule.test.mjs +121 -0
- package/dist/tests/programmes/rules/DegreeDisciplineRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/DegreeDisciplineRule.test.mjs +169 -0
- package/dist/tests/programmes/rules/IndexableDegreeRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/IndexableDegreeRule.test.mjs +101 -0
- package/dist/tests/programmes/rules/IndexableDurationRule.test..d.mts +1 -0
- package/dist/tests/programmes/rules/IndexableDurationRule.test..mjs +25 -0
- package/dist/tests/programmes/rules/IndexableEducationalFormRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/IndexableEducationalFormRule.test.mjs +27 -0
- package/dist/tests/programmes/rules/IndexablePageNumberRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/IndexablePageNumberRule.test.mjs +51 -0
- package/dist/tests/programmes/rules/MbaDegreeRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/MbaDegreeRule.test.mjs +55 -0
- package/dist/tests/programmes/rules/MbaOrMscDegreeRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/MbaOrMscDegreeRule.test.mjs +53 -0
- package/dist/tests/programmes/rules/MinimumAmountOfResultsRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/MinimumAmountOfResultsRule.test.mjs +79 -0
- package/dist/tests/programmes/rules/NotDistanceLearningPortalRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/NotDistanceLearningPortalRule.test.mjs +57 -0
- package/dist/tests/programmes/rules/OneYearDurationRule.test..d.mts +1 -0
- package/dist/tests/programmes/rules/OneYearDurationRule.test..mjs +40 -0
- package/dist/tests/programmes/rules/OnlineAttendanceRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/OnlineAttendanceRule.test.mjs +69 -0
- package/dist/tests/programmes/rules/PartTimeFormatRule.test.d.mts +1 -0
- package/dist/tests/programmes/rules/PartTimeFormatRule.test.mjs +27 -0
- package/dist/tests/programmes/utils/SearchDependencies.util.d.mts +16 -0
- package/dist/tests/programmes/utils/SearchDependencies.util.mjs +73 -0
- package/dist/tests/programmes/utils/SitemapDependencies.util.d.mts +15 -0
- package/dist/tests/programmes/utils/SitemapDependencies.util.mjs +49 -0
- package/dist/tests/scholarships/policies/Area.test.d.mts +1 -0
- package/dist/tests/scholarships/policies/Area.test.mjs +121 -0
- package/dist/tests/scholarships/policies/Country.test.d.mts +1 -0
- package/dist/tests/scholarships/policies/Country.test.mjs +97 -0
- package/dist/tests/scholarships/policies/Discipline.test.d.mts +1 -0
- package/dist/tests/scholarships/policies/Discipline.test.mjs +93 -0
- package/dist/tests/scholarships/policies/DisciplineCountry.test.d.mts +1 -0
- package/dist/tests/scholarships/policies/DisciplineCountry.test.mjs +151 -0
- package/dist/tests/scholarships/policies/Unfiltered.test.d.mts +1 -0
- package/dist/tests/scholarships/policies/Unfiltered.test.mjs +44 -0
- package/dist/tests/scholarships/policies/UniversityCountry.test.d.mts +1 -0
- package/dist/tests/scholarships/policies/UniversityCountry.test.mjs +115 -0
- package/dist/tests/scholarships/rules/ExceptAustaliaAreasRule.test.d.mts +1 -0
- package/dist/tests/scholarships/rules/ExceptAustaliaAreasRule.test.mjs +64 -0
- package/dist/tests/scholarships/rules/SearchVolumeAreasRule.test.d.mts +1 -0
- package/dist/tests/scholarships/rules/SearchVolumeAreasRule.test.mjs +62 -0
- package/dist/tests/scholarships/rules/SearchVolumeCountriesDisciplinesRule.test.d.mts +1 -0
- package/dist/tests/scholarships/rules/SearchVolumeCountriesDisciplinesRule.test.mjs +114 -0
- package/dist/tests/scholarships/rules/SearchVolumeCountriesRule.test.d.mts +1 -0
- package/dist/tests/scholarships/rules/SearchVolumeCountriesRule.test.mjs +62 -0
- package/dist/tests/scholarships/rules/SearchVolumeDisciplinesRule.test.d.mts +1 -0
- package/dist/tests/scholarships/rules/SearchVolumeDisciplinesRule.test.mjs +62 -0
- package/dist/tests/scholarships/utils/SearchDependencies.util.d.mts +16 -0
- package/dist/tests/scholarships/utils/SearchDependencies.util.mjs +70 -0
- package/dist/tests/scholarships/utils/SitemapDependencies.util.d.mts +11 -0
- package/dist/tests/scholarships/utils/SitemapDependencies.util.mjs +33 -0
- package/dist/tests/sitemap-generator/BaseSitemapUrlGeneratorManager.test.d.mts +1 -0
- package/dist/tests/sitemap-generator/BaseSitemapUrlGeneratorManager.test.mjs +82 -0
- package/dist/tests/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.test.d.mts +1 -0
- package/dist/tests/sitemap-generator/OrganisationsSitemapUrlGeneratorManager.test.mjs +85 -0
- package/dist/tests/sitemap-generator/ProgrammesSitemapUrlGeneratorManager.test.d.mts +1 -0
- package/dist/tests/sitemap-generator/ProgrammesSitemapUrlGeneratorManager.test.mjs +77 -0
- package/dist/tests/sitemap-generator/ScholarshipsSitemapUrlGeneratorManager.test.d.mts +1 -0
- package/dist/tests/sitemap-generator/ScholarshipsSitemapUrlGeneratorManager.test.mjs +60 -0
- package/dist/tests/structured-data/OrganisationStructuredDataFactory.test.d.mts +1 -0
- package/dist/tests/structured-data/OrganisationStructuredDataFactory.test.mjs +334 -0
- package/dist/tests/structured-data/ProgrammeStructuredDataFactory.test.d.mts +1 -0
- package/dist/tests/structured-data/ProgrammeStructuredDataFactory.test.mjs +562 -0
- package/dist/tests/structured-data/ScholarshipStructuredDataFactory.test.d.mts +1 -0
- package/dist/tests/structured-data/ScholarshipStructuredDataFactory.test.mjs +292 -0
- package/dist/tests/structured-data/SearchStructuredDataFactory.paywall.test.d.mts +1 -0
- package/dist/tests/structured-data/SearchStructuredDataFactory.paywall.test.mjs +258 -0
- package/package.json +1 -1
- package/dist/src/programmes/policies/AttendanceTuitionFee.d.ts +0 -17
- package/dist/src/programmes/policies/AttendanceTuitionFee.js +0 -51
- package/dist/src/programmes/policies/ContinentTuitionFee.d.ts +0 -16
- package/dist/src/programmes/policies/ContinentTuitionFee.js +0 -46
- package/dist/src/programmes/policies/CountryTuitionFee.d.ts +0 -16
- package/dist/src/programmes/policies/CountryTuitionFee.js +0 -46
- package/dist/src/programmes/policies/DegreeAreaTuitionFee.d.ts +0 -16
- package/dist/src/programmes/policies/DisciplineTuitionFee.js +0 -46
- package/dist/src/programmes/policies/DisciplineTuitionFeeAttendance.d.ts +0 -17
- package/dist/src/programmes/policies/DisciplineTuitionFeeAttendance.js +0 -54
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
|
|
2
|
+
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
3
|
+
import { SearchDependencies } from '../utils/SearchDependencies.util.mjs';
|
|
4
|
+
import { SitemapDependencies } from '../utils/SitemapDependencies.util.mjs';
|
|
5
|
+
import { Attendance } from '@/programmes/policies/Attendance';
|
|
6
|
+
import { PortalType } from '@studyportals/domain-client';
|
|
7
|
+
import { AttendancePresenter } from '@/presenters/AttendancePresenter';
|
|
8
|
+
describe('Policy:Attendance', () => {
|
|
9
|
+
describe('shouldIndex', () => {
|
|
10
|
+
let searchDependenciesHelper;
|
|
11
|
+
let attendancePolicy;
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
searchDependenciesHelper = new SearchDependencies();
|
|
14
|
+
attendancePolicy = new Attendance(searchDependenciesHelper.dependencies);
|
|
15
|
+
searchDependenciesHelper.setResultsCount(10);
|
|
16
|
+
searchDependenciesHelper.setPageNumber(1);
|
|
17
|
+
searchDependenciesHelper.setPortalType(PortalType.BACHELOR);
|
|
18
|
+
});
|
|
19
|
+
it('Should return true when all conditions are met', async () => {
|
|
20
|
+
const attendance = 'online';
|
|
21
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DELIVERY_METHOD, [attendance]]]));
|
|
22
|
+
const result = await attendancePolicy.shouldIndex();
|
|
23
|
+
expect(result).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it('Should return false when multiple attendance values are selected', async () => {
|
|
26
|
+
const firstAttendance = 'online';
|
|
27
|
+
const secondAttendance = 'blended';
|
|
28
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DELIVERY_METHOD, [firstAttendance, secondAttendance]]]));
|
|
29
|
+
const result = await attendancePolicy.shouldIndex();
|
|
30
|
+
expect(result).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it('Should return false when no attendance values are selected', async () => {
|
|
33
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([]));
|
|
34
|
+
const result = await attendancePolicy.shouldIndex();
|
|
35
|
+
expect(result).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
it('Should return false when other filters are selected', async () => {
|
|
38
|
+
const attendance = 'online';
|
|
39
|
+
const countryId = '202'; // Australia
|
|
40
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
41
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
42
|
+
[FilterKey.COUNTRY, [countryId]]
|
|
43
|
+
]));
|
|
44
|
+
const result = await attendancePolicy.shouldIndex();
|
|
45
|
+
expect(result).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
it('Should return false when attendance is not online', async () => {
|
|
48
|
+
const attendance = 'blended';
|
|
49
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DELIVERY_METHOD, [attendance]]]));
|
|
50
|
+
const result = await attendancePolicy.shouldIndex();
|
|
51
|
+
expect(result).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
it('Should return false when number of results is less than 7', async () => {
|
|
54
|
+
const attendance = 'online';
|
|
55
|
+
searchDependenciesHelper.setResultsCount(6);
|
|
56
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DELIVERY_METHOD, [attendance]]]));
|
|
57
|
+
const result = await attendancePolicy.shouldIndex();
|
|
58
|
+
expect(result).toBe(false);
|
|
59
|
+
});
|
|
60
|
+
it('Should return false when page number is higher than 2', async () => {
|
|
61
|
+
const attendance = 'online';
|
|
62
|
+
searchDependenciesHelper.setPageNumber(3);
|
|
63
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DELIVERY_METHOD, [attendance]]]));
|
|
64
|
+
const result = await attendancePolicy.shouldIndex();
|
|
65
|
+
expect(result).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
it('Should return false when portal is distance learning', async () => {
|
|
68
|
+
const attendance = 'online';
|
|
69
|
+
searchDependenciesHelper.setPortalType(PortalType.DISTANCE_LEARNING);
|
|
70
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DELIVERY_METHOD, [attendance]]]));
|
|
71
|
+
const result = await attendancePolicy.shouldIndex();
|
|
72
|
+
expect(result).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
describe('generateUrls', () => {
|
|
76
|
+
let sitemapDependenciesHelper;
|
|
77
|
+
let attendancePolicy;
|
|
78
|
+
beforeEach(() => {
|
|
79
|
+
sitemapDependenciesHelper = new SitemapDependencies();
|
|
80
|
+
sitemapDependenciesHelper.setProgrammeCount(10); // More than 7 programs
|
|
81
|
+
attendancePolicy = new Attendance(sitemapDependenciesHelper.dependencies);
|
|
82
|
+
AttendancePresenter.getInstance = vi.fn().mockReturnValue({
|
|
83
|
+
getFragments: vi.fn().mockReturnValue([
|
|
84
|
+
{ id: 'online', path: 'online-programmes' },
|
|
85
|
+
{ id: 'face2face', path: 'on-campus-programmes' },
|
|
86
|
+
{ id: 'blended', path: 'blended-programmes' }
|
|
87
|
+
])
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
afterEach(() => {
|
|
91
|
+
sitemapDependenciesHelper.resetMocks();
|
|
92
|
+
});
|
|
93
|
+
it('Should generate URLs for online attendance only', async () => {
|
|
94
|
+
// Mock the checkRulesForSitemap to return true only for online attendance due to OnlineAttendanceRule
|
|
95
|
+
const resultMap = new Map([
|
|
96
|
+
[`${FilterKey.DELIVERY_METHOD}:online`, true],
|
|
97
|
+
[`${FilterKey.DELIVERY_METHOD}:face2face`, false],
|
|
98
|
+
[`${FilterKey.DELIVERY_METHOD}:blended`, false]
|
|
99
|
+
]);
|
|
100
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
101
|
+
// Call the method via reflection since it's protected
|
|
102
|
+
const urls = await attendancePolicy.generateUrls();
|
|
103
|
+
// Verify only online attendance was included
|
|
104
|
+
expect(urls).toHaveLength(1);
|
|
105
|
+
expect(urls).toContain('online-programmes');
|
|
106
|
+
expect(urls).not.toContain('on-campus-programmes');
|
|
107
|
+
expect(urls).not.toContain('blended-programmes');
|
|
108
|
+
});
|
|
109
|
+
it('Should exclude all URLs when all checks fail', async () => {
|
|
110
|
+
// Create a map that returns false for all attendance types
|
|
111
|
+
const resultMap = new Map([
|
|
112
|
+
[`${FilterKey.DELIVERY_METHOD}:online`, false],
|
|
113
|
+
[`${FilterKey.DELIVERY_METHOD}:face2face`, false],
|
|
114
|
+
[`${FilterKey.DELIVERY_METHOD}:blended`, false]
|
|
115
|
+
]);
|
|
116
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
117
|
+
const urls = await attendancePolicy.generateUrls();
|
|
118
|
+
// Should include no URLs
|
|
119
|
+
expect(urls).toHaveLength(0);
|
|
120
|
+
});
|
|
121
|
+
it('Should handle empty fragments array', async () => {
|
|
122
|
+
// Mock the AttendancePresenter to return empty fragments
|
|
123
|
+
AttendancePresenter.getInstance.mockReturnValueOnce({
|
|
124
|
+
getFragments: vi.fn().mockReturnValue([])
|
|
125
|
+
});
|
|
126
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
127
|
+
const urls = await attendancePolicy.generateUrls();
|
|
128
|
+
// Should return empty array
|
|
129
|
+
expect(urls).toHaveLength(0);
|
|
130
|
+
});
|
|
131
|
+
it('Should handle multiple attendance types if rule allows', async () => {
|
|
132
|
+
// This is a hypothetical scenario where the rule might allow multiple attendance types
|
|
133
|
+
// (in production, OnlineAttendanceRule would only allow online)
|
|
134
|
+
const resultMap = new Map([
|
|
135
|
+
[`${FilterKey.DELIVERY_METHOD}:online`, true],
|
|
136
|
+
[`${FilterKey.DELIVERY_METHOD}:face2face`, true],
|
|
137
|
+
[`${FilterKey.DELIVERY_METHOD}:blended`, false]
|
|
138
|
+
]);
|
|
139
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
140
|
+
const urls = await attendancePolicy.generateUrls();
|
|
141
|
+
// Should include online and on-campus
|
|
142
|
+
expect(urls).toHaveLength(2);
|
|
143
|
+
expect(urls).toContain('online-programmes');
|
|
144
|
+
expect(urls).toContain('on-campus-programmes');
|
|
145
|
+
expect(urls).not.toContain('blended-programmes');
|
|
146
|
+
});
|
|
147
|
+
it('Should handle performance with a larger set of attendance types', async () => {
|
|
148
|
+
// Generate more attendance types for testing
|
|
149
|
+
const largeAttendanceSet = Array.from({ length: 10 }, (_, index) => ({
|
|
150
|
+
id: `attendance-${index}`,
|
|
151
|
+
path: `attendance-type-${index}`
|
|
152
|
+
}));
|
|
153
|
+
// Mock the AttendancePresenter to return large set
|
|
154
|
+
AttendancePresenter.getInstance.mockReturnValueOnce({
|
|
155
|
+
getFragments: vi.fn().mockReturnValue(largeAttendanceSet)
|
|
156
|
+
});
|
|
157
|
+
// Mock to only allow attendance types with even indices
|
|
158
|
+
const resultMap = new Map();
|
|
159
|
+
for (let i = 0; i < largeAttendanceSet.length; i++) {
|
|
160
|
+
const attendanceId = largeAttendanceSet[i].id;
|
|
161
|
+
resultMap.set(`${FilterKey.DELIVERY_METHOD}:${attendanceId}`, i % 2 === 0);
|
|
162
|
+
}
|
|
163
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
164
|
+
const urls = await attendancePolicy.generateUrls();
|
|
165
|
+
// Should include half of the attendance types (those with even indices)
|
|
166
|
+
expect(urls).toHaveLength(5);
|
|
167
|
+
// Check specific items
|
|
168
|
+
expect(urls).toContain('attendance-type-0'); // Even index
|
|
169
|
+
expect(urls).not.toContain('attendance-type-1'); // Odd index
|
|
170
|
+
expect(urls).toContain('attendance-type-2'); // Even index
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
|
|
2
|
+
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
3
|
+
import { SearchDependencies } from '../utils/SearchDependencies.util.mjs';
|
|
4
|
+
import { SitemapDependencies } from '../utils/SitemapDependencies.util.mjs';
|
|
5
|
+
import { AttendanceDegree } from '@/programmes/policies/AttendanceDegree';
|
|
6
|
+
import { PortalType } from '@studyportals/domain-client';
|
|
7
|
+
import { AttendancePresenter } from '@/presenters/AttendancePresenter';
|
|
8
|
+
import { DegreePresenter } from '@/presenters/DegreePresenter';
|
|
9
|
+
describe('Policy:AttendanceDegree', () => {
|
|
10
|
+
describe('shouldIndex', () => {
|
|
11
|
+
let searchDependenciesHelper;
|
|
12
|
+
let attendanceDegreePolicy;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
searchDependenciesHelper = new SearchDependencies();
|
|
15
|
+
attendanceDegreePolicy = new AttendanceDegree(searchDependenciesHelper.dependencies);
|
|
16
|
+
searchDependenciesHelper.setResultsCount(10);
|
|
17
|
+
searchDependenciesHelper.setPageNumber(1);
|
|
18
|
+
searchDependenciesHelper.setPortalType(PortalType.PHD);
|
|
19
|
+
});
|
|
20
|
+
it('Should return true when all conditions are met', async () => {
|
|
21
|
+
const attendance = 'online';
|
|
22
|
+
const degree = 'phd';
|
|
23
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
24
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
25
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
26
|
+
]));
|
|
27
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
28
|
+
expect(result).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
it('Should return false when multiple attendance values are selected', async () => {
|
|
31
|
+
const firstAttendance = 'online';
|
|
32
|
+
const secondAttendance = 'blended';
|
|
33
|
+
const degree = 'phd';
|
|
34
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
35
|
+
[FilterKey.DELIVERY_METHOD, [firstAttendance, secondAttendance]],
|
|
36
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
37
|
+
]));
|
|
38
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
39
|
+
expect(result).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
it('Should return false when multiple degree values are selected', async () => {
|
|
42
|
+
const attendance = 'online';
|
|
43
|
+
const firstDegree = 'phd';
|
|
44
|
+
const secondDegree = 'mba';
|
|
45
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
46
|
+
[FilterKey.DEGREE_TYPE, [firstDegree, secondDegree]],
|
|
47
|
+
[FilterKey.DELIVERY_METHOD, [attendance]]
|
|
48
|
+
]));
|
|
49
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
50
|
+
expect(result).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
it('Should return false when no attendance values are selected', async () => {
|
|
53
|
+
const degree = 'phd';
|
|
54
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DEGREE_TYPE, [degree]]]));
|
|
55
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
56
|
+
expect(result).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it('Should return false when no degree values are selected', async () => {
|
|
59
|
+
const attendance = 'online';
|
|
60
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DELIVERY_METHOD, [attendance]]]));
|
|
61
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
62
|
+
expect(result).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
it('Should return false when other filters are selected', async () => {
|
|
65
|
+
const attendance = 'online';
|
|
66
|
+
const degree = 'phd';
|
|
67
|
+
const countryId = '202'; // Australia
|
|
68
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
69
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
70
|
+
[FilterKey.DEGREE_TYPE, [degree]],
|
|
71
|
+
[FilterKey.COUNTRY, [countryId]]
|
|
72
|
+
]));
|
|
73
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
74
|
+
expect(result).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
it('Should return true when attendance is blended (now allowed)', async () => {
|
|
77
|
+
const attendance = 'blended';
|
|
78
|
+
const degree = 'mba';
|
|
79
|
+
searchDependenciesHelper.setPortalType(PortalType.MASTER);
|
|
80
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
81
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
82
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
83
|
+
]));
|
|
84
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
85
|
+
expect(result).toBe(true);
|
|
86
|
+
});
|
|
87
|
+
it('Should return true for blended in shouldIndex (filtered in generateUrls)', async () => {
|
|
88
|
+
const attendance = 'blended';
|
|
89
|
+
const degree = 'mba';
|
|
90
|
+
searchDependenciesHelper.setPortalType(PortalType.MASTER);
|
|
91
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
92
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
93
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
94
|
+
]));
|
|
95
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
96
|
+
expect(result).toBe(true); // Basic validation passes, but generateUrls filters for online/blended only
|
|
97
|
+
});
|
|
98
|
+
it('Should verify new rule: Blended Learning + Degree is indexable', async () => {
|
|
99
|
+
const attendance = 'blended';
|
|
100
|
+
const degree = 'phd';
|
|
101
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
102
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
103
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
104
|
+
]));
|
|
105
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
106
|
+
expect(result).toBe(true);
|
|
107
|
+
});
|
|
108
|
+
it('Should return false when degree is not indexable (i.e. Academy Profession)', async () => {
|
|
109
|
+
const attendance = 'online';
|
|
110
|
+
const degree = 'ap';
|
|
111
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
112
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
113
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
114
|
+
]));
|
|
115
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
116
|
+
expect(result).toBe(false);
|
|
117
|
+
});
|
|
118
|
+
it('Should return false when number of results is less than 7', async () => {
|
|
119
|
+
const attendance = 'online';
|
|
120
|
+
const degree = 'phd';
|
|
121
|
+
searchDependenciesHelper.setResultsCount(6);
|
|
122
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
123
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
124
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
125
|
+
]));
|
|
126
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
127
|
+
expect(result).toBe(false);
|
|
128
|
+
});
|
|
129
|
+
it('Should return false when page number is higher than 2', async () => {
|
|
130
|
+
const attendance = 'online';
|
|
131
|
+
const degree = 'phd';
|
|
132
|
+
searchDependenciesHelper.setPageNumber(3);
|
|
133
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
134
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
135
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
136
|
+
]));
|
|
137
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
138
|
+
expect(result).toBe(false);
|
|
139
|
+
});
|
|
140
|
+
it('Should return false when portal is distance learning', async () => {
|
|
141
|
+
const attendance = 'online';
|
|
142
|
+
const degree = 'phd';
|
|
143
|
+
searchDependenciesHelper.setPortalType(PortalType.DISTANCE_LEARNING);
|
|
144
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
145
|
+
[FilterKey.DELIVERY_METHOD, [attendance]],
|
|
146
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
147
|
+
]));
|
|
148
|
+
const result = await attendanceDegreePolicy.shouldIndex();
|
|
149
|
+
expect(result).toBe(false);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe('generateUrls', () => {
|
|
153
|
+
let sitemapDependenciesHelper;
|
|
154
|
+
let attendanceDegreePolicy;
|
|
155
|
+
beforeEach(() => {
|
|
156
|
+
sitemapDependenciesHelper = new SitemapDependencies();
|
|
157
|
+
sitemapDependenciesHelper.setProgrammeCount(10); // More than 7 programs
|
|
158
|
+
attendanceDegreePolicy = new AttendanceDegree(sitemapDependenciesHelper.dependencies);
|
|
159
|
+
AttendancePresenter.getInstance = vi.fn().mockReturnValue({
|
|
160
|
+
getFragments: vi.fn().mockReturnValue([
|
|
161
|
+
{ id: 'online', path: 'online' },
|
|
162
|
+
{ id: 'face2face', path: 'on-campus' },
|
|
163
|
+
{ id: 'blended', path: 'blended' }
|
|
164
|
+
])
|
|
165
|
+
});
|
|
166
|
+
DegreePresenter.getInstance = vi.fn().mockReturnValue({
|
|
167
|
+
getFragments: vi.fn().mockReturnValue([
|
|
168
|
+
{ id: 'mba', path: 'mba' },
|
|
169
|
+
{ id: 'msc', path: 'msc' },
|
|
170
|
+
{ id: 'phd', path: 'phd' },
|
|
171
|
+
{ id: 'ap', path: 'ap' } // Non-indexable degree
|
|
172
|
+
])
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
afterEach(() => {
|
|
176
|
+
sitemapDependenciesHelper.resetMocks();
|
|
177
|
+
});
|
|
178
|
+
it('Should generate URLs for valid attendance-degree combinations', async () => {
|
|
179
|
+
// Mock the checkRulesForSitemap to return true for online and blended attendance
|
|
180
|
+
// with indexable degrees (not AP)
|
|
181
|
+
const resultMap = new Map([
|
|
182
|
+
// Online with different degrees
|
|
183
|
+
[`${FilterKey.DELIVERY_METHOD}:online|${FilterKey.DEGREE_TYPE}:mba`, true],
|
|
184
|
+
[`${FilterKey.DELIVERY_METHOD}:online|${FilterKey.DEGREE_TYPE}:msc`, true],
|
|
185
|
+
[`${FilterKey.DELIVERY_METHOD}:online|${FilterKey.DEGREE_TYPE}:phd`, true],
|
|
186
|
+
[`${FilterKey.DELIVERY_METHOD}:online|${FilterKey.DEGREE_TYPE}:ap`, false], // Non-indexable degree
|
|
187
|
+
// Face-to-face with any degree (not allowed in generateUrls)
|
|
188
|
+
[`${FilterKey.DELIVERY_METHOD}:face2face|${FilterKey.DEGREE_TYPE}:mba`, false],
|
|
189
|
+
[`${FilterKey.DELIVERY_METHOD}:face2face|${FilterKey.DEGREE_TYPE}:msc`, false],
|
|
190
|
+
[`${FilterKey.DELIVERY_METHOD}:face2face|${FilterKey.DEGREE_TYPE}:phd`, false],
|
|
191
|
+
[`${FilterKey.DELIVERY_METHOD}:face2face|${FilterKey.DEGREE_TYPE}:ap`, false],
|
|
192
|
+
// Blended with indexable degrees (now allowed)
|
|
193
|
+
[`${FilterKey.DELIVERY_METHOD}:blended|${FilterKey.DEGREE_TYPE}:mba`, true],
|
|
194
|
+
[`${FilterKey.DELIVERY_METHOD}:blended|${FilterKey.DEGREE_TYPE}:msc`, true],
|
|
195
|
+
[`${FilterKey.DELIVERY_METHOD}:blended|${FilterKey.DEGREE_TYPE}:phd`, true],
|
|
196
|
+
[`${FilterKey.DELIVERY_METHOD}:blended|${FilterKey.DEGREE_TYPE}:ap`, false] // Non-indexable degree
|
|
197
|
+
]);
|
|
198
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
199
|
+
// Call the method via reflection since it's protected
|
|
200
|
+
const urls = await attendanceDegreePolicy.generateUrls();
|
|
201
|
+
// Verify online and blended with indexable degrees were included
|
|
202
|
+
expect(urls).toHaveLength(6);
|
|
203
|
+
expect(urls).toContain('mba/online');
|
|
204
|
+
expect(urls).toContain('msc/online');
|
|
205
|
+
expect(urls).toContain('phd/online');
|
|
206
|
+
expect(urls).toContain('mba/blended');
|
|
207
|
+
expect(urls).toContain('msc/blended');
|
|
208
|
+
expect(urls).toContain('phd/blended');
|
|
209
|
+
// These combinations should be excluded
|
|
210
|
+
expect(urls).not.toContain('ap/online');
|
|
211
|
+
expect(urls).not.toContain('ap/blended');
|
|
212
|
+
expect(urls).not.toContain('mba/face2face');
|
|
213
|
+
});
|
|
214
|
+
it('Should exclude all URLs when all checks fail', async () => {
|
|
215
|
+
// Create a map that returns false for all combinations
|
|
216
|
+
const resultMap = new Map();
|
|
217
|
+
for (const attendance of ['online', 'face2face', 'blended']) {
|
|
218
|
+
for (const degree of ['mba', 'msc', 'phd', 'ap']) {
|
|
219
|
+
const key = `${FilterKey.DELIVERY_METHOD}:${attendance}|${FilterKey.DEGREE_TYPE}:${degree}`;
|
|
220
|
+
resultMap.set(key, false);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
224
|
+
const urls = await attendanceDegreePolicy.generateUrls();
|
|
225
|
+
// Should include no URLs
|
|
226
|
+
expect(urls).toHaveLength(0);
|
|
227
|
+
});
|
|
228
|
+
it('Should handle empty attendance fragments', async () => {
|
|
229
|
+
// Mock the AttendancePresenter to return empty fragments
|
|
230
|
+
AttendancePresenter.getInstance.mockReturnValueOnce({
|
|
231
|
+
getFragments: vi.fn().mockReturnValue([])
|
|
232
|
+
});
|
|
233
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
234
|
+
const urls = await attendanceDegreePolicy.generateUrls();
|
|
235
|
+
// Should return empty array
|
|
236
|
+
expect(urls).toHaveLength(0);
|
|
237
|
+
});
|
|
238
|
+
it('Should handle empty degree fragments', async () => {
|
|
239
|
+
// Mock the DegreePresenter to return empty fragments
|
|
240
|
+
DegreePresenter.getInstance.mockReturnValueOnce({
|
|
241
|
+
getFragments: vi.fn().mockReturnValue([])
|
|
242
|
+
});
|
|
243
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
244
|
+
const urls = await attendanceDegreePolicy.generateUrls();
|
|
245
|
+
// Should return empty array
|
|
246
|
+
expect(urls).toHaveLength(0);
|
|
247
|
+
});
|
|
248
|
+
it('Should handle performance with large number of combinations', async () => {
|
|
249
|
+
// Generate larger sets for testing - only include allowed attendance types
|
|
250
|
+
const largeAttendanceSet = [
|
|
251
|
+
{ id: 'online', path: 'online' },
|
|
252
|
+
{ id: 'blended', path: 'blended' },
|
|
253
|
+
{ id: 'face2face', path: 'on-campus' }, // This won't be used by generateUrls
|
|
254
|
+
{ id: 'parttime', path: 'part-time' }, // This won't be used by generateUrls
|
|
255
|
+
{ id: 'fulltime', path: 'full-time' } // This won't be used by generateUrls
|
|
256
|
+
];
|
|
257
|
+
const largeDegreeSet = Array.from({ length: 10 }, (_, index) => ({
|
|
258
|
+
id: `degree-${index}`,
|
|
259
|
+
path: `degree-type-${index}`
|
|
260
|
+
}));
|
|
261
|
+
// Override mocks with large datasets
|
|
262
|
+
AttendancePresenter.getInstance.mockReturnValueOnce({
|
|
263
|
+
getFragments: vi.fn().mockReturnValue(largeAttendanceSet)
|
|
264
|
+
});
|
|
265
|
+
DegreePresenter.getInstance.mockReturnValueOnce({
|
|
266
|
+
getFragments: vi.fn().mockReturnValue(largeDegreeSet)
|
|
267
|
+
});
|
|
268
|
+
// Mock to allow only some combinations
|
|
269
|
+
const resultMap = new Map();
|
|
270
|
+
for (const attendance of largeAttendanceSet) {
|
|
271
|
+
for (let d = 0; d < largeDegreeSet.length; d++) {
|
|
272
|
+
const degreeId = largeDegreeSet[d].id;
|
|
273
|
+
const key = `${FilterKey.DELIVERY_METHOD}:${attendance.id}|${FilterKey.DEGREE_TYPE}:${degreeId}`;
|
|
274
|
+
// Only allow online/blended with even indexed degrees
|
|
275
|
+
const isAllowedAttendance = attendance.id === 'online' || attendance.id === 'blended';
|
|
276
|
+
resultMap.set(key, isAllowedAttendance && d % 2 === 0);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
280
|
+
const urls = await attendanceDegreePolicy.generateUrls();
|
|
281
|
+
// Calculate expected count: 2 attendance types (online, blended) * 5 degrees (0,2,4,6,8)
|
|
282
|
+
// = 2 * 5 = 10 URLs
|
|
283
|
+
expect(urls).toHaveLength(10);
|
|
284
|
+
// Test some specific combinations
|
|
285
|
+
expect(urls).toContain('degree-type-0/online');
|
|
286
|
+
expect(urls).toContain('degree-type-4/blended');
|
|
287
|
+
expect(urls).not.toContain('degree-type-0/on-campus'); // Face2face not allowed
|
|
288
|
+
expect(urls).not.toContain('degree-type-1/online'); // Odd degree index
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, vi, afterEach } from 'vitest';
|
|
2
|
+
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
3
|
+
import { SearchDependencies } from '../utils/SearchDependencies.util.mjs';
|
|
4
|
+
import { SitemapDependencies } from '../utils/SitemapDependencies.util.mjs';
|
|
5
|
+
import { Continent } from '@/programmes/policies/Continent';
|
|
6
|
+
import { PortalType } from '@studyportals/domain-client';
|
|
7
|
+
import { ContinentPresenter } from '@/presenters/ContinentPresenter';
|
|
8
|
+
describe('Policy:Continent', () => {
|
|
9
|
+
describe('shouldIndex', () => {
|
|
10
|
+
let searchDependenciesHelper;
|
|
11
|
+
let continentPolicy;
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
searchDependenciesHelper = new SearchDependencies();
|
|
14
|
+
continentPolicy = new Continent(searchDependenciesHelper.dependencies);
|
|
15
|
+
searchDependenciesHelper.setResultsCount(10);
|
|
16
|
+
searchDependenciesHelper.setPageNumber(1);
|
|
17
|
+
searchDependenciesHelper.setPortalType(PortalType.SHORT);
|
|
18
|
+
});
|
|
19
|
+
it('Should return true when all conditions are met', async () => {
|
|
20
|
+
const continentId = '1'; // Europe
|
|
21
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.CONTINENT, [continentId]]]));
|
|
22
|
+
const result = await continentPolicy.shouldIndex();
|
|
23
|
+
expect(result).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
it('Should return false when multiple continents are selected', async () => {
|
|
26
|
+
const firstContinentId = '1'; // Europe
|
|
27
|
+
const secondContinentId = '9'; // Asia
|
|
28
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.CONTINENT, [firstContinentId, secondContinentId]]]));
|
|
29
|
+
const result = await continentPolicy.shouldIndex();
|
|
30
|
+
expect(result).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it('Should return false when no continents are selected', async () => {
|
|
33
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([]));
|
|
34
|
+
const result = await continentPolicy.shouldIndex();
|
|
35
|
+
expect(result).toBe(false);
|
|
36
|
+
});
|
|
37
|
+
it('Should return false when other filters are selected', async () => {
|
|
38
|
+
const continentId = '1'; // Europe
|
|
39
|
+
const disciplineId = '54'; // Agriculture & Forestry
|
|
40
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
41
|
+
[FilterKey.CONTINENT, [continentId]],
|
|
42
|
+
[FilterKey.DISCIPLINES, [disciplineId]]
|
|
43
|
+
]));
|
|
44
|
+
const result = await continentPolicy.shouldIndex();
|
|
45
|
+
expect(result).toBe(false);
|
|
46
|
+
});
|
|
47
|
+
it('Should return false when number of results is less than 7', async () => {
|
|
48
|
+
const continentId = '9'; // Asia
|
|
49
|
+
searchDependenciesHelper.setResultsCount(6);
|
|
50
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.CONTINENT, [continentId]]]));
|
|
51
|
+
const result = await continentPolicy.shouldIndex();
|
|
52
|
+
expect(result).toBe(false);
|
|
53
|
+
});
|
|
54
|
+
it('Should return false when page number is higher than 2', async () => {
|
|
55
|
+
const continentId = '1'; // Europe
|
|
56
|
+
searchDependenciesHelper.setPageNumber(5);
|
|
57
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.CONTINENT, [continentId]]]));
|
|
58
|
+
const result = await continentPolicy.shouldIndex();
|
|
59
|
+
expect(result).toBe(false);
|
|
60
|
+
});
|
|
61
|
+
it('Should return false when portal type is distance learning', async () => {
|
|
62
|
+
const continentId = '1'; // Europe
|
|
63
|
+
searchDependenciesHelper.setPortalType(PortalType.DISTANCE_LEARNING);
|
|
64
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.CONTINENT, [continentId]]]));
|
|
65
|
+
const result = await continentPolicy.shouldIndex();
|
|
66
|
+
expect(result).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
describe('generateUrls', () => {
|
|
70
|
+
let sitemapDependenciesHelper;
|
|
71
|
+
let continentPolicy;
|
|
72
|
+
beforeEach(() => {
|
|
73
|
+
sitemapDependenciesHelper = new SitemapDependencies();
|
|
74
|
+
sitemapDependenciesHelper.setProgrammeCount(10); // More than 7 programs
|
|
75
|
+
continentPolicy = new Continent(sitemapDependenciesHelper.dependencies);
|
|
76
|
+
ContinentPresenter.getInstance = vi.fn().mockReturnValue({
|
|
77
|
+
getFragments: vi.fn().mockReturnValue([
|
|
78
|
+
{ id: '1', path: 'europe' },
|
|
79
|
+
{ id: '9', path: 'asia' },
|
|
80
|
+
{ id: '2', path: 'north-america' },
|
|
81
|
+
{ id: '6', path: 'south-america' },
|
|
82
|
+
{ id: '4', path: 'africa' }
|
|
83
|
+
])
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
afterEach(() => {
|
|
87
|
+
sitemapDependenciesHelper.resetMocks();
|
|
88
|
+
});
|
|
89
|
+
it('Should generate URLs for all valid continents', async () => {
|
|
90
|
+
// Mock the checkRulesForSitemap to return true for all continent combinations
|
|
91
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
92
|
+
// Call the method via reflection since it's protected
|
|
93
|
+
const urls = await continentPolicy.generateUrls();
|
|
94
|
+
// Verify all continent fragments were included
|
|
95
|
+
expect(urls).toHaveLength(5);
|
|
96
|
+
expect(urls).toContain('europe');
|
|
97
|
+
expect(urls).toContain('asia');
|
|
98
|
+
expect(urls).toContain('north-america');
|
|
99
|
+
expect(urls).toContain('south-america');
|
|
100
|
+
expect(urls).toContain('africa');
|
|
101
|
+
});
|
|
102
|
+
it('Should exclude URLs that fail rule checks', async () => {
|
|
103
|
+
// Create a map that returns false for Europe and Africa
|
|
104
|
+
const resultMap = new Map([
|
|
105
|
+
[`${FilterKey.CONTINENT}:1`, false],
|
|
106
|
+
[`${FilterKey.CONTINENT}:4`, false]
|
|
107
|
+
]);
|
|
108
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
109
|
+
const urls = await continentPolicy.generateUrls();
|
|
110
|
+
// Should only include Asia, North America, and South America
|
|
111
|
+
expect(urls).toHaveLength(3);
|
|
112
|
+
expect(urls).toContain('asia');
|
|
113
|
+
expect(urls).toContain('north-america');
|
|
114
|
+
expect(urls).toContain('south-america');
|
|
115
|
+
expect(urls).not.toContain('europe');
|
|
116
|
+
expect(urls).not.toContain('africa');
|
|
117
|
+
});
|
|
118
|
+
it('Should exclude all URLs when all checks fail', async () => {
|
|
119
|
+
// Create a map that returns false for all continents
|
|
120
|
+
const resultMap = new Map([
|
|
121
|
+
[`${FilterKey.CONTINENT}:1`, false],
|
|
122
|
+
[`${FilterKey.CONTINENT}:9`, false],
|
|
123
|
+
[`${FilterKey.CONTINENT}:2`, false],
|
|
124
|
+
[`${FilterKey.CONTINENT}:6`, false],
|
|
125
|
+
[`${FilterKey.CONTINENT}:4`, false]
|
|
126
|
+
]);
|
|
127
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
128
|
+
const urls = await continentPolicy.generateUrls();
|
|
129
|
+
// Should include no URLs
|
|
130
|
+
expect(urls).toHaveLength(0);
|
|
131
|
+
});
|
|
132
|
+
it('Should handle empty fragments array', async () => {
|
|
133
|
+
// Mock the ContinentPresenter to return empty fragments
|
|
134
|
+
ContinentPresenter.getInstance.mockReturnValueOnce({
|
|
135
|
+
getFragments: vi.fn().mockReturnValue([])
|
|
136
|
+
});
|
|
137
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
138
|
+
const urls = await continentPolicy.generateUrls();
|
|
139
|
+
// Should return empty array
|
|
140
|
+
expect(urls).toHaveLength(0);
|
|
141
|
+
});
|
|
142
|
+
it('Should handle performance with a large number of continents', async () => {
|
|
143
|
+
// For this test, we'll generate a hypothetical larger set of continents
|
|
144
|
+
// (in reality there are just a few continents)
|
|
145
|
+
const largeContinentSet = Array.from({ length: 50 }, (_, index) => ({
|
|
146
|
+
id: `continent-${index}`,
|
|
147
|
+
path: `continent-path-${index}`
|
|
148
|
+
}));
|
|
149
|
+
// Mock the ContinentPresenter to return large set
|
|
150
|
+
ContinentPresenter.getInstance.mockReturnValueOnce({
|
|
151
|
+
getFragments: vi.fn().mockReturnValue(largeContinentSet)
|
|
152
|
+
});
|
|
153
|
+
// Mock to allow only continents with even indices
|
|
154
|
+
const resultMap = new Map();
|
|
155
|
+
for (let i = 0; i < largeContinentSet.length; i++) {
|
|
156
|
+
const continentId = largeContinentSet[i].id;
|
|
157
|
+
resultMap.set(`${FilterKey.CONTINENT}:${continentId}`, i % 2 === 0);
|
|
158
|
+
}
|
|
159
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
160
|
+
const urls = await continentPolicy.generateUrls();
|
|
161
|
+
// Should include half of the continents (those with even indices)
|
|
162
|
+
expect(urls).toHaveLength(25);
|
|
163
|
+
// Check specific items
|
|
164
|
+
expect(urls).toContain('continent-path-0'); // Even index
|
|
165
|
+
expect(urls).not.toContain('continent-path-1'); // Odd index
|
|
166
|
+
expect(urls).toContain('continent-path-2'); // Even index
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|