Keep a typed main kind from being ranked as the catalog other kind, and store that catalog kind on the finished Rule.
This commit is contained in:
1 parent
4b90bce006
commit
3e0181e4de
7 files changed
+174
-48
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { TYPED_ORG_TYPE_MARKER } from "../../lib/create/deckTypes";
|
||||
import {
|
||||
flattenRequestedFacets,
|
||||
methodFacetsSchema,
|
||||
@@ -66,6 +67,17 @@ describe("parseRequestedFacetsFromSearchParams", () => {
|
||||
params.append("foo", "bar");
|
||||
expect(parseRequestedFacetsFromSearchParams(params)).toEqual({});
|
||||
});
|
||||
|
||||
it("keeps a typed main-kind marker ahead of catalog kinds", () => {
|
||||
const params = new URLSearchParams();
|
||||
params.append("facet.orgType", TYPED_ORG_TYPE_MARKER);
|
||||
params.append("facet.orgType", "not-a-kind");
|
||||
params.append("facet.orgType", "workersCoop");
|
||||
expect(parseRequestedFacetsFromSearchParams(params).orgType).toEqual([
|
||||
TYPED_ORG_TYPE_MARKER,
|
||||
"workersCoop",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("flattenRequestedFacets", () => {
|
||||
@@ -80,4 +92,12 @@ describe("flattenRequestedFacets", () => {
|
||||
{ group: "orgType", value: "dao" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("omits the typed main-kind marker from scoring pairs", () => {
|
||||
expect(
|
||||
flattenRequestedFacets({
|
||||
orgType: [TYPED_ORG_TYPE_MARKER, "workersCoop"],
|
||||
}),
|
||||
).toEqual([{ group: "orgType", value: "workersCoop" }]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user