Skip to content

Commit 7101afe

Browse files
authored
test(perso): work around limitations on setPersonalizationStrategy (#1179)
* test(perso): work around limitations on setPersonalizationStrategy fixes #1178 * chore: fix lint * rougher test
1 parent 2e8eb58 commit 7101afe

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

packages/client-recommendation/src/__tests__/features/personalization-strategy.test.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,23 @@ test(testSuite.testName, async () => {
3636
personalizationImpact: 0,
3737
};
3838

39-
const response: SetPersonalizationStrategyResponse = {
39+
const successResponse: SetPersonalizationStrategyResponse = {
4040
status: 200,
4141
message: 'Strategy was successfully updated',
4242
};
4343

44-
await expect(client.setPersonalizationStrategy(personalizationStrategy)).resolves.toEqual(
45-
response
46-
);
44+
const errorResponse: SetPersonalizationStrategyResponse = {
45+
status: 429,
46+
message: 'Number of strategy saves exceeded for the day',
47+
};
48+
49+
try {
50+
const response = await client.setPersonalizationStrategy(personalizationStrategy);
51+
expect(response).toEqual(successResponse);
52+
} catch (error) {
53+
// eslint-disable-next-line jest/no-try-expect
54+
expect(error).toEqual(expect.objectContaining({ name: 'ApiError', ...errorResponse }));
55+
}
4756

4857
await expect(client.getPersonalizationStrategy()).resolves.toEqual(personalizationStrategy);
4958
});

0 commit comments

Comments
 (0)