Skip to content

Commit

Permalink
Add traceId to vitest facet objects
Browse files Browse the repository at this point in the history
We dont need a valid traceId while testing, which is why an empty or mocked string will work just fine
  • Loading branch information
JacobArrow committed Jan 9, 2025
1 parent e16d442 commit b0adf94
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
17 changes: 17 additions & 0 deletions src/components/facet-browser/__snapshots__/helper.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,43 @@ exports[`createFacetsMap 1`] = `
"key": "dan",
"score": 427,
"term": "Dansk",
"traceId": "2",
},
"mainLanguages:eng": {
"key": "eng",
"score": 82,
"term": "Engelsk",
"traceId": "3",
},
"materialTypesGeneral:artikler": {
"key": "artikler",
"score": 346,
"term": "artikler",
"traceId": "4",
},
"materialTypesGeneral:bøger": {
"key": "bøger",
"score": 74,
"term": "bøger",
"traceId": "5",
},
"materialTypesGeneral:computerspil": {
"key": "computerspil",
"score": 26,
"term": "computerspil",
"traceId": "7",
},
"materialTypesGeneral:e-bøger": {
"key": "e-bøger",
"score": 38,
"term": "e-bøger",
"traceId": "6",
},
"materialTypesGeneral:film": {
"key": "film",
"score": 9,
"term": "film",
"traceId": "8",
},
}
`;
Expand Down Expand Up @@ -77,6 +84,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -87,6 +95,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -97,6 +106,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -107,6 +117,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -117,6 +128,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -127,6 +139,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -137,6 +150,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -147,6 +161,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -157,6 +172,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand All @@ -167,6 +183,7 @@ exports[`getPlaceHolderFacets > should get placeholder facets 1`] = `
{
"key": "",
"term": "",
"traceId": "",
},
],
},
Expand Down
36 changes: 24 additions & 12 deletions src/components/facet-browser/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export const getPlaceHolderFacets = (facets: string[]) =>
values: [
{
key: "",
term: ""
term: "",
traceId: ""
}
]
}));
Expand Down Expand Up @@ -182,19 +183,22 @@ if (import.meta.vitest) {
Dansk: {
key: "dan",
term: "Dansk",
score: 295
score: 295,
traceId: "1"
},
Engelsk: {
key: "eng",
term: "Engelsk",
score: 9
score: 9,
traceId: "2"
}
},
accessTypes: {
Fysisk: {
key: "PHYSICAL",
term: "Fysisk",
score: 356
score: 356,
traceId: "3"
}
}
};
Expand All @@ -207,7 +211,8 @@ if (import.meta.vitest) {
{
key: "computerspil",
term: "computerspil",
score: 26
score: 26,
traceId: "1"
}
]
},
Expand All @@ -218,12 +223,14 @@ if (import.meta.vitest) {
{
key: "dan",
term: "Dansk",
score: 427
score: 427,
traceId: "2"
},
{
key: "eng",
term: "Engelsk",
score: 82
score: 82,
traceId: "3"
}
]
},
Expand All @@ -234,27 +241,32 @@ if (import.meta.vitest) {
{
key: "artikler",
term: "artikler",
score: 346
score: 346,
traceId: "4"
},
{
key: "bøger",
term: "bøger",
score: 74
score: 74,
traceId: "5"
},
{
key: "e-bøger",
term: "e-bøger",
score: 38
score: 38,
traceId: "6"
},
{
key: "computerspil",
term: "computerspil",
score: 26
score: 26,
traceId: "7"
},
{
key: "film",
term: "film",
score: 9
score: 9,
traceId: "8"
}
]
}
Expand Down

0 comments on commit b0adf94

Please sign in to comment.