@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,234 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
|
+
import { FilterKey } from '@studyportals/search-filters/server-side';
|
|
3
|
+
import { SearchDependencies } from '../utils/SearchDependencies.util.mjs';
|
|
4
|
+
import { CountryDuration } from '@/programmes/policies/CountryDuration';
|
|
5
|
+
import { PortalType } from '@studyportals/domain-client';
|
|
6
|
+
import { SitemapDependencies } from '../utils/SitemapDependencies.util.mjs';
|
|
7
|
+
import { CountryPresenter } from '@/presenters/CountryPresenter';
|
|
8
|
+
import { DurationPresenter } from '@/presenters/DurationPresenter';
|
|
9
|
+
describe('Policy:CountryDuration', () => {
|
|
10
|
+
describe('shouldIndex', () => {
|
|
11
|
+
let searchDependenciesHelper;
|
|
12
|
+
let countryDurationPolicy;
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
searchDependenciesHelper = new SearchDependencies();
|
|
15
|
+
countryDurationPolicy = new CountryDuration(searchDependenciesHelper.dependencies);
|
|
16
|
+
searchDependenciesHelper.setResultsCount(10);
|
|
17
|
+
searchDependenciesHelper.setPageNumber(1);
|
|
18
|
+
searchDependenciesHelper.setPortalType(PortalType.BACHELOR);
|
|
19
|
+
});
|
|
20
|
+
it('Should return true when all conditions are met', async () => {
|
|
21
|
+
const countryId = '30'; // UK
|
|
22
|
+
const duration = '[360,360]'; // 1 year
|
|
23
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
24
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
25
|
+
[FilterKey.DURATION, [duration]]
|
|
26
|
+
]));
|
|
27
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
28
|
+
expect(result).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
it('Should return false when multiple countries are selected', async () => {
|
|
31
|
+
const firstCountryId = '30'; // UK
|
|
32
|
+
const secondCountryId = '21'; // Portugal
|
|
33
|
+
const duration = '[360,360]'; // 1 year
|
|
34
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
35
|
+
[FilterKey.COUNTRY, [firstCountryId, secondCountryId]],
|
|
36
|
+
[FilterKey.DURATION, [duration]]
|
|
37
|
+
]));
|
|
38
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
39
|
+
expect(result).toBe(false);
|
|
40
|
+
});
|
|
41
|
+
it('Should return false when multiple duration values are selected', async () => {
|
|
42
|
+
const countryId = '30'; // UK
|
|
43
|
+
const firstDuration = '[360,360]'; // 1 year
|
|
44
|
+
const secondDuration = '[720,720]'; // 2 years
|
|
45
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
46
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
47
|
+
[FilterKey.DURATION, [firstDuration, secondDuration]]
|
|
48
|
+
]));
|
|
49
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
50
|
+
expect(result).toBe(false);
|
|
51
|
+
});
|
|
52
|
+
it('Should return false when no duration values are selected', async () => {
|
|
53
|
+
const countryId = '30'; // UK
|
|
54
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.COUNTRY, [countryId]]]));
|
|
55
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
56
|
+
expect(result).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it('Should return false when no countries are selected', async () => {
|
|
59
|
+
const duration = '[360,360]'; // 1 year
|
|
60
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([[FilterKey.DURATION, [duration]]]));
|
|
61
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
62
|
+
expect(result).toBe(false);
|
|
63
|
+
});
|
|
64
|
+
it('Should return false when other filters are selected', async () => {
|
|
65
|
+
const countryId = '30'; // UK
|
|
66
|
+
const duration = '[360,360]'; // 1 year
|
|
67
|
+
const disciplineId = '54'; // Agriculture & Forestry
|
|
68
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
69
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
70
|
+
[FilterKey.DURATION, [duration]],
|
|
71
|
+
[FilterKey.DISCIPLINES, [disciplineId]]
|
|
72
|
+
]));
|
|
73
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
74
|
+
expect(result).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
it('Should return false when duration is not indexable (i.e. 2 years)', async () => {
|
|
77
|
+
const countryId = '30'; // UK
|
|
78
|
+
const duration = '[720,720]'; // 2 years
|
|
79
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
80
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
81
|
+
[FilterKey.DURATION, [duration]]
|
|
82
|
+
]));
|
|
83
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
84
|
+
expect(result).toBe(false);
|
|
85
|
+
});
|
|
86
|
+
it('Should return false when number of results is less than 7', async () => {
|
|
87
|
+
const countryId = '30'; // UK
|
|
88
|
+
const duration = '[360,360]'; // 1 year
|
|
89
|
+
searchDependenciesHelper.setResultsCount(6);
|
|
90
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
91
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
92
|
+
[FilterKey.DURATION, [duration]]
|
|
93
|
+
]));
|
|
94
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
95
|
+
expect(result).toBe(false);
|
|
96
|
+
});
|
|
97
|
+
it('Should return false when page number is higher than 2', async () => {
|
|
98
|
+
const countryId = '30'; // UK
|
|
99
|
+
const duration = '[360,360]'; // 1 year
|
|
100
|
+
searchDependenciesHelper.setPageNumber(4);
|
|
101
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
102
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
103
|
+
[FilterKey.DURATION, [duration]]
|
|
104
|
+
]));
|
|
105
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
106
|
+
expect(result).toBe(false);
|
|
107
|
+
});
|
|
108
|
+
it('Should return false when portal is distance learning', async () => {
|
|
109
|
+
const countryId = '30'; // UK
|
|
110
|
+
const duration = '[360,360]'; // 1 year
|
|
111
|
+
searchDependenciesHelper.setPortalType(PortalType.DISTANCE_LEARNING);
|
|
112
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
113
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
114
|
+
[FilterKey.DURATION, [duration]]
|
|
115
|
+
]));
|
|
116
|
+
const result = await countryDurationPolicy.shouldIndex();
|
|
117
|
+
expect(result).toBe(false);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
describe('generateUrls', () => {
|
|
121
|
+
let sitemapDependenciesHelper;
|
|
122
|
+
let countryDurationPolicy;
|
|
123
|
+
beforeEach(() => {
|
|
124
|
+
sitemapDependenciesHelper = new SitemapDependencies();
|
|
125
|
+
sitemapDependenciesHelper.setProgrammeCount(10); // More than 7 programs
|
|
126
|
+
countryDurationPolicy = new CountryDuration(sitemapDependenciesHelper.dependencies);
|
|
127
|
+
CountryPresenter.getInstance = vi.fn().mockReturnValue({
|
|
128
|
+
getFragments: vi.fn().mockReturnValue([
|
|
129
|
+
{ id: '30', path: 'uk' },
|
|
130
|
+
{ id: '202', path: 'australia' },
|
|
131
|
+
{ id: '56', path: 'usa' }
|
|
132
|
+
])
|
|
133
|
+
});
|
|
134
|
+
DurationPresenter.getInstance = vi.fn().mockReturnValue({
|
|
135
|
+
getFragments: vi.fn().mockReturnValue([
|
|
136
|
+
{ id: '[360,360]', path: '1-year' },
|
|
137
|
+
{ id: '[720,720]', path: '2-years' },
|
|
138
|
+
{ id: '[1080,1080]', path: '3-years' },
|
|
139
|
+
{ id: '[1440,1440]', path: '4-years' },
|
|
140
|
+
{ id: '[-1,719]', path: 'less-than-2-years' } // Non-indexable duration
|
|
141
|
+
])
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
afterEach(() => {
|
|
145
|
+
sitemapDependenciesHelper.resetMocks();
|
|
146
|
+
});
|
|
147
|
+
it('Should generate URLs for valid country-duration combinations', async () => {
|
|
148
|
+
// Mock the checkRulesForSitemap to filter out non-indexable durations for all countries
|
|
149
|
+
const resultMap = new Map();
|
|
150
|
+
// Set up all possible combinations - only [360,360] (1-year) is allowed by the policy
|
|
151
|
+
for (const country of ['30', '202', '56']) {
|
|
152
|
+
for (const duration of ['[360,360]', '[720,720]', '[1080,1080]', '[1440,1440]', '[-1,719]']) {
|
|
153
|
+
const key = `${FilterKey.COUNTRY}:${country}|${FilterKey.DURATION}:${duration}`;
|
|
154
|
+
// Only [360,360] should be allowed by the policy's allowedDurationIds
|
|
155
|
+
resultMap.set(key, duration === '[360,360]');
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
159
|
+
// Call the method via reflection since it's protected
|
|
160
|
+
const urls = await countryDurationPolicy.generateUrls();
|
|
161
|
+
// Calculate expected URLs: 3 countries * 1 duration ([360,360] only) * 1 page = 3 URLs
|
|
162
|
+
expect(urls).toHaveLength(3);
|
|
163
|
+
// Verify paths structure
|
|
164
|
+
expect(urls).toContain('1-year/uk');
|
|
165
|
+
expect(urls).toContain('1-year/australia');
|
|
166
|
+
expect(urls).toContain('1-year/usa');
|
|
167
|
+
// Verify other durations are excluded
|
|
168
|
+
expect(urls).not.toContain('2-years/uk');
|
|
169
|
+
expect(urls).not.toContain('3-years/uk');
|
|
170
|
+
expect(urls).not.toContain('4-years/uk');
|
|
171
|
+
expect(urls).not.toContain('less-than-2-years/uk');
|
|
172
|
+
});
|
|
173
|
+
it('Should exclude specific country-duration combinations based on rules', async () => {
|
|
174
|
+
// Create a map that returns false for specific combinations
|
|
175
|
+
const resultMap = new Map();
|
|
176
|
+
// Only [360,360] is allowed by policy, but we can exclude specific countries
|
|
177
|
+
for (const country of ['30', '202', '56']) {
|
|
178
|
+
for (const duration of ['[360,360]', '[720,720]', '[1080,1080]', '[1440,1440]', '[-1,719]']) {
|
|
179
|
+
const key = `${FilterKey.COUNTRY}:${country}|${FilterKey.DURATION}:${duration}`;
|
|
180
|
+
// Only [360,360] is allowed and exclude UK (30) for testing
|
|
181
|
+
const shouldPass = duration === '[360,360]' && country !== '30';
|
|
182
|
+
resultMap.set(key, shouldPass);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
186
|
+
const urls = await countryDurationPolicy.generateUrls();
|
|
187
|
+
// Calculate expected URLs: 2 countries (excluding UK) * 1 duration ([360,360]) = 2 URLs
|
|
188
|
+
expect(urls).toHaveLength(2);
|
|
189
|
+
// Verify excluded combinations
|
|
190
|
+
expect(urls).not.toContain('1-year/uk');
|
|
191
|
+
expect(urls).not.toContain('2-years/australia');
|
|
192
|
+
expect(urls).not.toContain('3-years/usa');
|
|
193
|
+
expect(urls).not.toContain('less-than-2-years/uk');
|
|
194
|
+
// Verify included combinations
|
|
195
|
+
expect(urls).toContain('1-year/australia');
|
|
196
|
+
expect(urls).toContain('1-year/usa');
|
|
197
|
+
});
|
|
198
|
+
it('Should exclude all URLs when all rule checks fail', async () => {
|
|
199
|
+
// Create a map that returns false for all combinations
|
|
200
|
+
const resultMap = new Map();
|
|
201
|
+
for (const country of ['30', '202', '56']) {
|
|
202
|
+
// Include [360,360] since that's what the policy actually uses
|
|
203
|
+
for (const duration of ['[360,360]', '[720,720]', '[1080,1080]', '[1440,1440]', '[-1,719]']) {
|
|
204
|
+
const key = `${FilterKey.COUNTRY}:${country}|${FilterKey.DURATION}:${duration}`;
|
|
205
|
+
resultMap.set(key, false);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
209
|
+
const urls = await countryDurationPolicy.generateUrls();
|
|
210
|
+
// Should include no URLs
|
|
211
|
+
expect(urls).toHaveLength(0);
|
|
212
|
+
});
|
|
213
|
+
it('Should handle empty country fragments', async () => {
|
|
214
|
+
// Mock the CountryPresenter to return empty fragments
|
|
215
|
+
CountryPresenter.getInstance.mockReturnValueOnce({
|
|
216
|
+
getFragments: vi.fn().mockReturnValue([])
|
|
217
|
+
});
|
|
218
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
219
|
+
const urls = await countryDurationPolicy.generateUrls();
|
|
220
|
+
// Should return empty array
|
|
221
|
+
expect(urls).toHaveLength(0);
|
|
222
|
+
});
|
|
223
|
+
it('Should handle empty duration fragments', async () => {
|
|
224
|
+
// Mock the DurationPresenter to return empty fragments
|
|
225
|
+
DurationPresenter.getInstance.mockReturnValueOnce({
|
|
226
|
+
getFragments: vi.fn().mockReturnValue([])
|
|
227
|
+
});
|
|
228
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
229
|
+
const urls = await countryDurationPolicy.generateUrls();
|
|
230
|
+
// Should return empty array
|
|
231
|
+
expect(urls).toHaveLength(0);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,304 @@
|
|
|
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 { CountryDurationDegree } from '@/programmes/policies/CountryDurationDegree';
|
|
5
|
+
import { PortalType } from '@studyportals/domain-client';
|
|
6
|
+
import { SitemapDependencies } from '../utils/SitemapDependencies.util.mjs';
|
|
7
|
+
import { CountryPresenter } from '@/presenters/CountryPresenter';
|
|
8
|
+
import { DegreePresenter } from '@/presenters/DegreePresenter';
|
|
9
|
+
import { DurationPresenter } from '@/presenters/DurationPresenter';
|
|
10
|
+
describe('Policy:CountryDurationDegree', () => {
|
|
11
|
+
describe('shouldIndex', () => {
|
|
12
|
+
let searchDependenciesHelper;
|
|
13
|
+
let countryDurationDegreePolicy;
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
searchDependenciesHelper = new SearchDependencies();
|
|
16
|
+
countryDurationDegreePolicy = new CountryDurationDegree(searchDependenciesHelper.dependencies);
|
|
17
|
+
searchDependenciesHelper.setResultsCount(10);
|
|
18
|
+
searchDependenciesHelper.setPageNumber(1);
|
|
19
|
+
searchDependenciesHelper.setPortalType(PortalType.PHD);
|
|
20
|
+
});
|
|
21
|
+
it('Should return true when all conditions are met (degree is MBA)', async () => {
|
|
22
|
+
const countryId = '30'; // UK
|
|
23
|
+
const duration = '[360,360]'; // 1 year
|
|
24
|
+
const degree = 'mba';
|
|
25
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
26
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
27
|
+
[FilterKey.DURATION, [duration]],
|
|
28
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
29
|
+
]));
|
|
30
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
31
|
+
expect(result).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
it('Should return true when all conditions are met (degree is MSC)', async () => {
|
|
34
|
+
const countryId = '30'; // UK
|
|
35
|
+
const duration = '[360,360]'; // 1 year
|
|
36
|
+
const degree = 'msc';
|
|
37
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
38
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
39
|
+
[FilterKey.DURATION, [duration]],
|
|
40
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
41
|
+
]));
|
|
42
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
43
|
+
expect(result).toBe(true);
|
|
44
|
+
});
|
|
45
|
+
it('Should return false when multiple countries are selected', async () => {
|
|
46
|
+
const firstCountryId = '30'; // UK
|
|
47
|
+
const secondCountryId = '21'; // Portugal
|
|
48
|
+
const duration = '[360,360]'; // 1 year
|
|
49
|
+
const degree = 'mba';
|
|
50
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
51
|
+
[FilterKey.COUNTRY, [firstCountryId, secondCountryId]],
|
|
52
|
+
[FilterKey.DURATION, [duration]],
|
|
53
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
54
|
+
]));
|
|
55
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
56
|
+
expect(result).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it('Should return false when degree is not MBA or MSC', async () => {
|
|
59
|
+
const countryId = '30'; // UK
|
|
60
|
+
const duration = '[360,360]'; // 1 year
|
|
61
|
+
const degree = 'phd';
|
|
62
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
63
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
64
|
+
[FilterKey.DURATION, [duration]],
|
|
65
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
66
|
+
]));
|
|
67
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
68
|
+
expect(result).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
it('Should return false when duration is not one year', async () => {
|
|
71
|
+
const countryId = '30'; // UK
|
|
72
|
+
const duration = '[720,720]'; // 2 years
|
|
73
|
+
const degree = 'mba';
|
|
74
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
75
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
76
|
+
[FilterKey.DURATION, [duration]],
|
|
77
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
78
|
+
]));
|
|
79
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
80
|
+
expect(result).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
it('Should return false when other filters are selected', async () => {
|
|
83
|
+
const countryId = '30'; // UK
|
|
84
|
+
const duration = '[360,360]'; // 1 year
|
|
85
|
+
const degree = 'mba';
|
|
86
|
+
const disciplineId = '12'; // Applied Sciences & Professions
|
|
87
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
88
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
89
|
+
[FilterKey.DURATION, [duration]],
|
|
90
|
+
[FilterKey.DEGREE_TYPE, [degree]],
|
|
91
|
+
[FilterKey.DISCIPLINES, [disciplineId]]
|
|
92
|
+
]));
|
|
93
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
94
|
+
expect(result).toBe(false);
|
|
95
|
+
});
|
|
96
|
+
it('Should return false when number of results is less than 7', async () => {
|
|
97
|
+
const countryId = '30'; // UK
|
|
98
|
+
const duration = '[360,360]'; // 1 year
|
|
99
|
+
const degree = 'mba';
|
|
100
|
+
searchDependenciesHelper.setResultsCount(6);
|
|
101
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
102
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
103
|
+
[FilterKey.DURATION, [duration]],
|
|
104
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
105
|
+
]));
|
|
106
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
107
|
+
expect(result).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
it('Should return false when page number is higher than 2', async () => {
|
|
110
|
+
const countryId = '30'; // UK
|
|
111
|
+
const duration = '[360,360]'; // 1 year
|
|
112
|
+
const degree = 'mba';
|
|
113
|
+
searchDependenciesHelper.setPageNumber(5);
|
|
114
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
115
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
116
|
+
[FilterKey.DURATION, [duration]],
|
|
117
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
118
|
+
]));
|
|
119
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
120
|
+
expect(result).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
it('Should return false when portal is distance learning', async () => {
|
|
123
|
+
const countryId = '30'; // UK
|
|
124
|
+
const duration = '[360,360]'; // 1 year
|
|
125
|
+
const degree = 'mba';
|
|
126
|
+
searchDependenciesHelper.setPortalType(PortalType.DISTANCE_LEARNING);
|
|
127
|
+
searchDependenciesHelper.setFilterKeyValues(new Map([
|
|
128
|
+
[FilterKey.COUNTRY, [countryId]],
|
|
129
|
+
[FilterKey.DURATION, [duration]],
|
|
130
|
+
[FilterKey.DEGREE_TYPE, [degree]]
|
|
131
|
+
]));
|
|
132
|
+
const result = await countryDurationDegreePolicy.shouldIndex();
|
|
133
|
+
expect(result).toBe(false);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('generateUrls', () => {
|
|
137
|
+
let sitemapDependenciesHelper;
|
|
138
|
+
let countryDurationDegreePolicy;
|
|
139
|
+
beforeEach(() => {
|
|
140
|
+
sitemapDependenciesHelper = new SitemapDependencies();
|
|
141
|
+
sitemapDependenciesHelper.setProgrammeCount(10); // More than 7 programs
|
|
142
|
+
countryDurationDegreePolicy = new CountryDurationDegree(sitemapDependenciesHelper.dependencies);
|
|
143
|
+
CountryPresenter.getInstance = vi.fn().mockReturnValue({
|
|
144
|
+
getFragments: vi.fn().mockReturnValue([
|
|
145
|
+
{ id: '30', path: 'uk' },
|
|
146
|
+
{ id: '21', path: 'portugal' },
|
|
147
|
+
{ id: '56', path: 'usa' },
|
|
148
|
+
{ id: '82', path: 'netherlands' }
|
|
149
|
+
])
|
|
150
|
+
});
|
|
151
|
+
DegreePresenter.getInstance = vi.fn().mockReturnValue({
|
|
152
|
+
getFragments: vi.fn().mockReturnValue([
|
|
153
|
+
{ id: 'mba', path: 'mba' },
|
|
154
|
+
{ id: 'msc', path: 'msc' },
|
|
155
|
+
{ id: 'phd', path: 'phd' }
|
|
156
|
+
])
|
|
157
|
+
});
|
|
158
|
+
DurationPresenter.getInstance = vi.fn().mockReturnValue({
|
|
159
|
+
getFragments: vi.fn().mockReturnValue([
|
|
160
|
+
{ id: '[360,360]', path: '1-year' },
|
|
161
|
+
{ id: '[720,720]', path: '2-years' },
|
|
162
|
+
{ id: '[1080,1080]', path: '3-years' }
|
|
163
|
+
])
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
afterEach(() => {
|
|
167
|
+
sitemapDependenciesHelper.resetMocks();
|
|
168
|
+
});
|
|
169
|
+
it('Should generate URLs for all valid degree-duration-country combinations', async () => {
|
|
170
|
+
// Mock the checkRulesForSitemap to only allow 1-year duration and MBA or MSC degrees
|
|
171
|
+
const resultMap = new Map();
|
|
172
|
+
// Set rules: only allow 1-year duration and MBA or MSC degrees
|
|
173
|
+
for (const countryId of ['30', '21', '56', '82']) {
|
|
174
|
+
for (const durationId of ['[360,360]', '[720,720]', '[1080,1080]']) {
|
|
175
|
+
for (const degreeId of ['mba', 'msc', 'phd']) {
|
|
176
|
+
const key = `${FilterKey.COUNTRY}:${countryId}|${FilterKey.DURATION}:${durationId}|${FilterKey.DEGREE_TYPE}:${degreeId}`;
|
|
177
|
+
resultMap.set(key, durationId === '[360,360]' && (degreeId === 'mba' || degreeId === 'msc'));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
182
|
+
// Call the method via reflection since it's protected
|
|
183
|
+
const urls = await countryDurationDegreePolicy.generateUrls();
|
|
184
|
+
// Verify only 1-year MBA/MSC combinations were included (2 degrees * 4 countries * 2 pages = 16 URLs)
|
|
185
|
+
expect(urls).toHaveLength(8);
|
|
186
|
+
expect(urls).toContain('mba/1-year/uk');
|
|
187
|
+
expect(urls).toContain('mba/1-year/portugal');
|
|
188
|
+
expect(urls).toContain('mba/1-year/usa');
|
|
189
|
+
expect(urls).toContain('mba/1-year/netherlands');
|
|
190
|
+
expect(urls).toContain('msc/1-year/uk');
|
|
191
|
+
expect(urls).toContain('msc/1-year/portugal');
|
|
192
|
+
expect(urls).toContain('msc/1-year/usa');
|
|
193
|
+
expect(urls).toContain('msc/1-year/netherlands');
|
|
194
|
+
expect(urls).not.toContain('mba/2-years/uk');
|
|
195
|
+
expect(urls).not.toContain('msc/2-years/uk');
|
|
196
|
+
expect(urls).not.toContain('phd/1-year/uk');
|
|
197
|
+
expect(urls).not.toContain('mba/2-years/uk');
|
|
198
|
+
});
|
|
199
|
+
it('Should exclude certain degree-duration-country combinations', async () => {
|
|
200
|
+
// Mock to exclude UK combinations
|
|
201
|
+
const resultMap = new Map();
|
|
202
|
+
// Set up rules to exclude UK for all durations and degrees
|
|
203
|
+
for (const countryId of ['30', '21', '56', '82']) {
|
|
204
|
+
for (const durationId of ['[360,360]', '[720,720]', '[1080,1080]']) {
|
|
205
|
+
for (const degreeId of ['mba', 'msc', 'phd']) {
|
|
206
|
+
const key = `${FilterKey.COUNTRY}:${countryId}|${FilterKey.DURATION}:${durationId}|${FilterKey.DEGREE_TYPE}:${degreeId}`;
|
|
207
|
+
// Exclude UK (30) and only allow 1-year MBA/MSC for others
|
|
208
|
+
resultMap.set(key, countryId !== '30' && durationId === '[360,360]' && (degreeId === 'mba' || degreeId === 'msc'));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
213
|
+
const urls = await countryDurationDegreePolicy.generateUrls();
|
|
214
|
+
// Should include others but not UK (2 degrees * 3 countries = 6 URLs)
|
|
215
|
+
expect(urls).toHaveLength(6);
|
|
216
|
+
expect(urls).toContain('mba/1-year/portugal');
|
|
217
|
+
expect(urls).toContain('mba/1-year/usa');
|
|
218
|
+
expect(urls).toContain('mba/1-year/netherlands');
|
|
219
|
+
expect(urls).toContain('msc/1-year/portugal');
|
|
220
|
+
expect(urls).toContain('msc/1-year/usa');
|
|
221
|
+
expect(urls).toContain('msc/1-year/netherlands');
|
|
222
|
+
expect(urls).not.toContain('mba/1-year/uk');
|
|
223
|
+
expect(urls).not.toContain('msc/1-year/uk');
|
|
224
|
+
});
|
|
225
|
+
it('Should exclude all URLs when all checks fail', async () => {
|
|
226
|
+
// Create a map that returns false for all combinations
|
|
227
|
+
const resultMap = new Map();
|
|
228
|
+
// Set all combinations to fail
|
|
229
|
+
for (const countryId of ['30', '21', '56', '82']) {
|
|
230
|
+
for (const durationId of ['[360,360]', '[720,720]', '[1080,1080]']) {
|
|
231
|
+
for (const degreeId of ['mba', 'msc', 'phd']) {
|
|
232
|
+
const key = `${FilterKey.COUNTRY}:${countryId}|${FilterKey.DURATION}:${durationId}|${FilterKey.DEGREE_TYPE}:${degreeId}`;
|
|
233
|
+
resultMap.set(key, false);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap, false);
|
|
238
|
+
const urls = await countryDurationDegreePolicy.generateUrls();
|
|
239
|
+
// Should include no URLs
|
|
240
|
+
expect(urls).toHaveLength(0);
|
|
241
|
+
});
|
|
242
|
+
it('Should handle empty fragments arrays', async () => {
|
|
243
|
+
// Mock the CountryPresenter to return empty fragments
|
|
244
|
+
CountryPresenter.getInstance.mockReturnValueOnce({
|
|
245
|
+
getFragments: vi.fn().mockReturnValue([])
|
|
246
|
+
});
|
|
247
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap();
|
|
248
|
+
const urls = await countryDurationDegreePolicy.generateUrls();
|
|
249
|
+
// Should return empty array
|
|
250
|
+
expect(urls).toHaveLength(0);
|
|
251
|
+
});
|
|
252
|
+
it('Should handle large number of combinations efficiently', async () => {
|
|
253
|
+
// Generate a smaller set of countries (10), durations (3) and degree types (3)
|
|
254
|
+
const largeCountrySet = Array.from({ length: 10 }, (_, index) => ({
|
|
255
|
+
id: `${1000 + index}`,
|
|
256
|
+
path: `country-${1000 + index}`
|
|
257
|
+
}));
|
|
258
|
+
const largeDurationSet = Array.from({ length: 3 }, (_, index) => ({
|
|
259
|
+
id: `duration-${index}`,
|
|
260
|
+
path: `duration-type-${index}`
|
|
261
|
+
}));
|
|
262
|
+
const largeDegreeSet = Array.from({ length: 3 }, (_, index) => ({
|
|
263
|
+
id: `degree-${index}`,
|
|
264
|
+
path: `degree-type-${index}`
|
|
265
|
+
}));
|
|
266
|
+
// Mock the presenters to return large sets
|
|
267
|
+
CountryPresenter.getInstance.mockReturnValueOnce({
|
|
268
|
+
getFragments: vi.fn().mockReturnValue(largeCountrySet)
|
|
269
|
+
});
|
|
270
|
+
DurationPresenter.getInstance.mockReturnValueOnce({
|
|
271
|
+
getFragments: vi.fn().mockReturnValue(largeDurationSet)
|
|
272
|
+
});
|
|
273
|
+
DegreePresenter.getInstance.mockReturnValueOnce({
|
|
274
|
+
getFragments: vi.fn().mockReturnValue(largeDegreeSet)
|
|
275
|
+
});
|
|
276
|
+
// Mock to allow only specific combinations
|
|
277
|
+
// Only allow countries divisible by 2, duration index 0, and degree index 0 or 1
|
|
278
|
+
const resultMap = new Map();
|
|
279
|
+
for (let c = 0; c < largeCountrySet.length; c++) {
|
|
280
|
+
for (let d = 0; d < largeDurationSet.length; d++) {
|
|
281
|
+
for (let g = 0; g < largeDegreeSet.length; g++) {
|
|
282
|
+
const countryId = largeCountrySet[c].id;
|
|
283
|
+
const durationId = largeDurationSet[d].id;
|
|
284
|
+
const degreeId = largeDegreeSet[g].id;
|
|
285
|
+
const key = `${FilterKey.COUNTRY}:${countryId}|${FilterKey.DURATION}:${durationId}|${FilterKey.DEGREE_TYPE}:${degreeId}`;
|
|
286
|
+
// Only include countries where index is divisible by 2, duration index 0, and degree index 0 or 1
|
|
287
|
+
resultMap.set(key, c % 2 === 0 && d === 0 && (g === 0 || g === 1));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
sitemapDependenciesHelper.mockCheckRulesForSitemap(resultMap);
|
|
292
|
+
const urls = await countryDurationDegreePolicy.generateUrls();
|
|
293
|
+
// Should generate 5 countries (10/2) * 1 duration type * 2 degree types * 2 pages = 20 URLs
|
|
294
|
+
expect(urls).toHaveLength(10);
|
|
295
|
+
// Test some specific combinations
|
|
296
|
+
expect(urls).toContain('degree-type-0/duration-type-0/country-1000'); // First valid country, first degree
|
|
297
|
+
expect(urls).toContain('degree-type-1/duration-type-0/country-1000'); // First valid country, second degree
|
|
298
|
+
expect(urls).toContain('degree-type-0/duration-type-0/country-1002'); // Another valid country, first degree
|
|
299
|
+
expect(urls).not.toContain('degree-type-0/duration-type-0/country-1001'); // Invalid country (not divisible by 2)
|
|
300
|
+
expect(urls).not.toContain('degree-type-2/duration-type-0/country-1000'); // Invalid degree
|
|
301
|
+
expect(urls).not.toContain('degree-type-0/duration-type-1/country-1000'); // Invalid duration
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|