Skip to content

Commit d1b5d5c

Browse files
abhishekpaypaljayasd12
authored andcommitted
add SSR - Server Side Rendering tests for AT button rendering
1 parent d15c384 commit d1b5d5c

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

test/ssr/ssr.test.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,52 @@ test(`Button should render with ssr, with en_HK locale option`, async () => {
189189
}
190190
});
191191

192+
test(`Button should render with ssr, with AT locale and paylater variant`, async () => {
193+
const { Buttons } = await getButtonScript();
194+
195+
const buttonHTML = Buttons({
196+
locale: { country: "AT", lang: "de" },
197+
platform: "desktop",
198+
sessionID: "xyz",
199+
buttonSessionID: "abc",
200+
fundingEligibility: {
201+
paypal: {
202+
eligible: true,
203+
},
204+
paylater: {
205+
eligible: true,
206+
products: {
207+
paylater: {
208+
eligible: true,
209+
variant: "AT",
210+
},
211+
},
212+
},
213+
card: {
214+
eligible: true,
215+
isPayPalBranded: true,
216+
vendors: {
217+
visa: { eligible: true },
218+
mastercard: { eligible: true },
219+
amex: { eligible: true },
220+
discover: { eligible: true },
221+
},
222+
},
223+
},
224+
}).render(html());
225+
226+
if (!buttonHTML || typeof buttonHTML !== "string") {
227+
throw new Error(`Expected html to be a non-empty string`);
228+
}
229+
230+
// Verify AT-specific label appears in rendered HTML
231+
if (!buttonHTML.includes("Später Bezahlen")) {
232+
throw new Error(
233+
`Expected SSR HTML to contain "Später Bezahlen" label for AT variant`
234+
);
235+
}
236+
});
237+
192238
// This is failing since validation of the color prop moved
193239
// This condition is tested in vitest
194240
test.skip(`Button should fail to render with ssr, with invalid style option`, async () => {

0 commit comments

Comments
 (0)