Skip to content

Commit

Permalink
Fix all mistakes in the /home page (#543)
Browse files Browse the repository at this point in the history
* Configured browsing by language

* Updated tests following the browsing cfg
  • Loading branch information
milanmajchrak authored Feb 27, 2024
1 parent 3fd6e82 commit 50d28ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,24 @@ public void findAll() throws Exception {
//We expect the content type to be "application/hal+json;charset=UTF-8"
.andExpect(content().contentType(contentType))

//Our default Discovery config has 5 browse indexes, so we expect this to be reflected in the page
//Our default Discovery config has 6 browse indexes, so we expect this to be reflected in the page
// object
.andExpect(jsonPath("$.page.size", is(20)))
.andExpect(jsonPath("$.page.totalElements", is(5)))
.andExpect(jsonPath("$.page.totalElements", is(6)))
.andExpect(jsonPath("$.page.totalPages", is(1)))
.andExpect(jsonPath("$.page.number", is(0)))

//The array of browse index should have a size 5
.andExpect(jsonPath("$._embedded.browses", hasSize(5)))
//The array of browse index should have a size 6
.andExpect(jsonPath("$._embedded.browses", hasSize(6)))

//Check that all (and only) the default browse indexes are present
.andExpect(jsonPath("$._embedded.browses", containsInAnyOrder(
BrowseIndexMatcher.dateIssuedBrowseIndex("asc"),
BrowseIndexMatcher.contributorBrowseIndex("asc"),
BrowseIndexMatcher.titleBrowseIndex("asc"),
BrowseIndexMatcher.subjectBrowseIndex("asc"),
BrowseIndexMatcher.hierarchicalBrowseIndex("srsc")
BrowseIndexMatcher.hierarchicalBrowseIndex("srsc"),
BrowseIndexMatcher.languageBrowseIndex("asc")
)))
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public static Matcher<? super Object> publisherBrowseIndex(final String order) {

public static Matcher<? super Object> languageBrowseIndex(final String order) {
return allOf(
hasJsonPath("$.metadata", contains("dc.language.iso")),
hasJsonPath("$.metadataBrowse", Matchers.is(true)),
hasJsonPath("$.dataType", equalToIgnoringCase("iso_lang")),
hasJsonPath("$.metadata", contains("local.language.name")),
hasJsonPath("$.browseType", equalToIgnoringCase(BROWSE_TYPE_VALUE_LIST)),
hasJsonPath("$.dataType", equalToIgnoringCase("text")),
hasJsonPath("$.order", equalToIgnoringCase(order)),
hasJsonPath("$.sortOptions[*].name", containsInAnyOrder("title", "dateissued", "dateaccessioned")),
hasJsonPath("$._links.self.href", is(REST_SERVER_URL + "discover/browses/language")),
Expand Down
4 changes: 2 additions & 2 deletions dspace/config/dspace.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1160,8 +1160,8 @@ webui.browse.index.1 = dateissued:item:dateissued
webui.browse.index.2 = author:metadata:dc.contributor.*\,dc.creator:text
webui.browse.index.3 = title:item:title
webui.browse.index.4 = subject:metadata:dc.subject.*:text
# webui.browse.index.5 = publisher:metadata:dc.publisher:text
# webui.browse.index.6 = language:metadata:dc.language.iso:iso_lang
webui.browse.index.5 = language:metadata:local.language.name:text
# webui.browse.index.6 = publisher:metadata:dc.publisher:text
# webui.browse.index.7 = itemtype:metadata:dc.type:text
# webui.browse.index.8 = rights:metadata:dc.rights.label:text

Expand Down

0 comments on commit 50d28ae

Please sign in to comment.