-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: finish return formatted facets and tests
- Loading branch information
Showing
7 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/collections/infra/repositories/transformers/CollectionItemsFacetsPayload.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export type CollectionItemsFacetPayload = [Record<string, CollectionItemsFacetPayloadValue>] | ||
|
||
export interface CollectionItemsFacetPayloadValue { | ||
friendly: string | ||
labels: Record<string, number>[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
test/testHelpers/collections/collectionItemsFacetsHelper.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { CollectionItemsFacet } from '../../../src/collections/domain/models/CollectionItemSubset' | ||
import { CollectionItemsFacetPayload } from '../../../src/collections/infra/repositories/transformers/CollectionItemsFacetsPayload' | ||
|
||
export const createCollectionItemsFacetsModel = (): CollectionItemsFacet[] => { | ||
return [ | ||
{ | ||
facet1: { | ||
friendly: 'Facet 1', | ||
labels: [ | ||
{ name: 'Label 1', count: 5 }, | ||
{ name: 'Label 2', count: 4 } | ||
] | ||
} | ||
}, | ||
{ | ||
facet2: { | ||
friendly: 'Facet 2', | ||
labels: [ | ||
{ name: 'Label 3', count: 8 }, | ||
{ name: 'Label 4', count: 9 } | ||
] | ||
} | ||
} | ||
] | ||
} | ||
|
||
export const createCollectionItemsFacetsPayload = (): CollectionItemsFacetPayload => { | ||
return [ | ||
{ | ||
facet1: { | ||
friendly: 'Facet 1', | ||
labels: [{ 'Label 1': 5 }, { 'Label 2': 4 }] | ||
}, | ||
facet2: { | ||
friendly: 'Facet 2', | ||
labels: [{ 'Label 3': 8 }, { 'Label 4': 9 }] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters