ci: trigga på master + formatfix inför Gitea Actions
CI / Typecheck, test & build (push) Failing after 2s
CI / Typecheck, test & build (push) Failing after 2s
This commit is contained in:
@@ -454,13 +454,29 @@ describe("S4 rekommendationsvyer", () => {
|
||||
});
|
||||
|
||||
// default utan samtycke = depersonalize(DEFAULT_WEIGHTS) == NON_PERSONALIZED_WEIGHTS
|
||||
const defaultRanked = rankAll([pantry, healthy, tasty], nonPersonalCtx, depersonalize(viewWeights("default")));
|
||||
const nonPersonalDefaultRanked = rankAll([pantry, healthy, tasty], nonPersonalCtx, NON_PERSONALIZED_WEIGHTS);
|
||||
expect(defaultRanked.map((r) => r.recipeId)).toEqual(nonPersonalDefaultRanked.map((r) => r.recipeId));
|
||||
const defaultRanked = rankAll(
|
||||
[pantry, healthy, tasty],
|
||||
nonPersonalCtx,
|
||||
depersonalize(viewWeights("default")),
|
||||
);
|
||||
const nonPersonalDefaultRanked = rankAll(
|
||||
[pantry, healthy, tasty],
|
||||
nonPersonalCtx,
|
||||
NON_PERSONALIZED_WEIGHTS,
|
||||
);
|
||||
expect(defaultRanked.map((r) => r.recipeId)).toEqual(
|
||||
nonPersonalDefaultRanked.map((r) => r.recipeId),
|
||||
);
|
||||
|
||||
// vyerna är fortfarande skilda från default även utan samtycke
|
||||
expect(rankAll([tasty, healthy, pantry], nonPersonalCtx, depersonalize(viewWeights("pantry")))[0]?.recipeId).toBe("pantry");
|
||||
expect(rankAll([tasty, pantry, healthy], nonPersonalCtx, depersonalize(viewWeights("health")))[0]?.recipeId).toBe("healthy");
|
||||
expect(
|
||||
rankAll([tasty, healthy, pantry], nonPersonalCtx, depersonalize(viewWeights("pantry")))[0]
|
||||
?.recipeId,
|
||||
).toBe("pantry");
|
||||
expect(
|
||||
rankAll([tasty, pantry, healthy], nonPersonalCtx, depersonalize(viewWeights("health")))[0]
|
||||
?.recipeId,
|
||||
).toBe("healthy");
|
||||
|
||||
// taste-vyn honoreras men personliga axlar är nollade
|
||||
const tasteWeights = depersonalize(viewWeights("taste"));
|
||||
|
||||
@@ -8,20 +8,7 @@ import {
|
||||
type ProvenanceEntry,
|
||||
} from "../src/index.js";
|
||||
|
||||
const EXPECTED_LANGS = [
|
||||
"sv",
|
||||
"en",
|
||||
"es",
|
||||
"it",
|
||||
"de",
|
||||
"fr",
|
||||
"da",
|
||||
"nb",
|
||||
"fi",
|
||||
"nl",
|
||||
"pl",
|
||||
"pt",
|
||||
];
|
||||
const EXPECTED_LANGS = ["sv", "en", "es", "it", "de", "fr", "da", "nb", "fi", "nl", "pl", "pt"];
|
||||
|
||||
const fullCoverage = { coverage: 1, matches: [], missing: [], expiringUsed: [] };
|
||||
const nutrition = {
|
||||
@@ -71,7 +58,9 @@ describe("S6 i18n-paritet", () => {
|
||||
const langsByTemplate = provenanceTemplateLanguages();
|
||||
expect(Object.keys(langsByTemplate).length).toBeGreaterThan(0);
|
||||
for (const [key, langs] of Object.entries(langsByTemplate)) {
|
||||
expect(langs.length, `mall ${key} har dubbletter eller saknar språk`).toBe(EXPECTED_LANGS.length);
|
||||
expect(langs.length, `mall ${key} har dubbletter eller saknar språk`).toBe(
|
||||
EXPECTED_LANGS.length,
|
||||
);
|
||||
expect(new Set(langs).size, `mall ${key} har dubbletter`).toBe(EXPECTED_LANGS.length);
|
||||
for (const lang of EXPECTED_LANGS) {
|
||||
expect(langs).toContain(lang);
|
||||
@@ -89,11 +78,31 @@ describe("S6 i18n-paritet", () => {
|
||||
});
|
||||
|
||||
it("buildWhy renderar på rätt språk för varje supporterat språk", () => {
|
||||
const provenance: ProvenanceEntry[] = [
|
||||
{ key: "favoriteCuisine", args: { cuisine: "svensk" } },
|
||||
];
|
||||
const provenance: ProvenanceEntry[] = [{ key: "favoriteCuisine", args: { cuisine: "svensk" } }];
|
||||
for (const lang of EXPECTED_LANGS) {
|
||||
const why = buildWhy(candidate(), { ...ctx, personalizationEnabled: true }, { coverage: 1, expiry: 0, nutritionFit: 0.9, taste: 0.5, rating: 0.5, season: 0, holiday: 0, time: 0, budget: 0, variety: 0.5, weather: 0.5, craving: 0.5, memoryFit: 1, tasteFit: 0, cookingAssumptionFit: 0 }, provenance, `${lang}-XX`);
|
||||
const why = buildWhy(
|
||||
candidate(),
|
||||
{ ...ctx, personalizationEnabled: true },
|
||||
{
|
||||
coverage: 1,
|
||||
expiry: 0,
|
||||
nutritionFit: 0.9,
|
||||
taste: 0.5,
|
||||
rating: 0.5,
|
||||
season: 0,
|
||||
holiday: 0,
|
||||
time: 0,
|
||||
budget: 0,
|
||||
variety: 0.5,
|
||||
weather: 0.5,
|
||||
craving: 0.5,
|
||||
memoryFit: 1,
|
||||
tasteFit: 0,
|
||||
cookingAssumptionFit: 0,
|
||||
},
|
||||
provenance,
|
||||
`${lang}-XX`,
|
||||
);
|
||||
expect(why.length, `tom why för ${lang}`).toBeGreaterThan(0);
|
||||
// Ingen why får falla tillbaka på svenska fallback om språket finns.
|
||||
if (lang !== "sv") {
|
||||
|
||||
Reference in New Issue
Block a user