1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

chore: add comprehensive logging for when test fails

This commit is contained in:
Thomas Heartman 2023-01-04 10:04:41 +01:00
parent 0af162a8e6
commit a39ba693aa
No known key found for this signature in database
GPG Key ID: 47CFBB2D87C87664

View File

@ -254,8 +254,35 @@ describe('Playground API E2E', () => {
const mappedToggles = createDict(body.features);
if (features.length !== body.features.length) {
const [longer, shorter] =
features.length > body.features.length
? [features, body.features]
: [body.features, features];
const extraFeatures = longer.filter(
(longerFeature) =>
shorter.some(
(shorterFeature) =>
longerFeature.name ===
shorterFeature.name,
),
);
ctx.log(
`I expected the number of mapped toggles (${body.features.length}) to be the same as the number of created toggles (${features.length}), but that was not the case.`,
`I expected the number of mapped toggles (${
body.features.length
}) to be the same as the number of generated toggles (${
features.length
}), but that was not the case.
The mapped toggles are ${JSON.stringify(body.features)}.
The generated toggles are ${JSON.stringify(features)}.
The following features are in the longer list, but not in the shorter: ${JSON.stringify(
extraFeatures,
)}
`,
);
return false;
}