Skip to content

Commit

Permalink
#1494: Remove residual key usage from facet responses (#1502)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuren1 authored Aug 7, 2023
1 parent 14287a3 commit 1f3b8b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions geonode_mapstore_client/client/js/utils/SearchUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ export const updateFilterFormItemsWithFacet = ({formItems, facetItems}) => {
return [
...acc,
...filteredFacetItems
.map(({ name, key, config, filter: filterKey, label, is_localized: isLocalized, loadItems } = {}) => {
.map(({ name, config, filter: filterKey, label, is_localized: isLocalized, loadItems } = {}) => {
const style = config.style || formItem.style;
const type = config.type || formItem.type;
return {
uuid: uuid(),
name,
key,
key: filterKey,
id: name,
type,
style,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ describe('Test Resource Utils', () => {
});
it('test with facet item and filter form items', () => {
const formItems = [{name: "1"}, {style: "facet", type: "accordion", facet: "thesaurus"}];
const facetItems = [{name: "some-name", key: "filterkey", label: "label1", type: "thesaurus", config: {style: "facet"}}];
const facetItems = [{name: "some-name", filter: "filterkey", label: "label1", type: "thesaurus", config: {style: "facet"}}];
const items = updateFilterFormItemsWithFacet({formItems, facetItems});
expect(items.length).toBe(2);
expect(items[1].name).toBe(facetItems[0].name);
expect(items[1].key).toBe(facetItems[0].key);
expect(items[1].key).toBe(facetItems[0].filter);
expect(items[1].id).toBe(facetItems[0].name);
expect(items[1].type).toBe("accordion");
expect(items[1].style).toBe("facet");
Expand All @@ -41,7 +41,7 @@ describe('Test Resource Utils', () => {
});
it('test with facet item by no matching facet', () => {
const formItems = [{name: "1"}, {style: "facet", type: "accordion", facet: "thesaurus"}];
const facetItems = [{name: "some-name", key: "filterkey", label: "label1", type: "owner", config: {style: "facet"}}];
const facetItems = [{name: "some-name", filter: "filterkey", label: "label1", type: "owner", config: {style: "facet"}}];
const items = updateFilterFormItemsWithFacet({formItems, facetItems});
expect(items.length).toBe(1);
expect(items[0].name).toEqual(formItems[0].name);
Expand All @@ -50,8 +50,8 @@ describe('Test Resource Utils', () => {
const config = {style: "facet"};
const formItems = [{ type: "group", items: [{style: "facet", type: "accordion", facet: "thesaurus"}] }];
const facetItems = [
{name: "some-name", key: "filterkey", label: "label1", type: "thesaurus", config},
{name: "some-name-2", key: "filterkey", label: "label2", type: "thesaurus", config}
{name: "some-name", filter: "filterkey", label: "label1", type: "thesaurus", config},
{name: "some-name-2", filter: "filterkey", label: "label2", type: "thesaurus", config}
];
const items = updateFilterFormItemsWithFacet({formItems, facetItems});
expect(items.length).toBe(1);
Expand Down

0 comments on commit 1f3b8b2

Please sign in to comment.