Onboarding / Deployment Scripts / Marketing updates

This commit is contained in:
2026-05-11 21:02:24 +12:00
parent a90dfb7c66
commit 955a563d14
110 changed files with 9803 additions and 937 deletions
+28 -13
View File
@@ -5,10 +5,10 @@ import { homepageContent } from '$lib/content/homepage';
import type { TestimonialContent } from '$lib/types';
const expectedMappedSlides = [
{ reviewer: 'Kate', src: '/images/archie-auckland-dog-walking-review.png' },
{ reviewer: 'Estelle', src: '/images/monty-auckland-dog-walking-review.png' },
{ reviewer: 'Ross', src: '/images/otis-auckland-dog-walking-review.png' },
{ reviewer: 'Nina', src: '/images/wallace-auckland-dog-walking-review.png' }
{ reviewer: 'Kate' },
{ reviewer: 'Estelle' },
{ reviewer: 'Ross' },
{ reviewer: 'Nina' }
];
function getActiveSlide(container: HTMLElement) {
@@ -23,6 +23,14 @@ function getActiveImage(container: HTMLElement) {
return getActiveSlide(container).querySelector('img') as HTMLImageElement;
}
function getNextButton(container: HTMLElement) {
return container.querySelector('.testimonial-arrow-right') as HTMLButtonElement;
}
function getPreviousButton(container: HTMLElement) {
return container.querySelector('.testimonial-arrow-left') as HTMLButtonElement;
}
describe('TestimonialsSection', () => {
afterEach(() => {
vi.useRealTimers();
@@ -33,11 +41,11 @@ describe('TestimonialsSection', () => {
testimonials: homepageContent.testimonials
});
const nextButton = screen.getByRole('button', { name: /next testimonial/i });
const nextButton = getNextButton(container);
for (const [index, slide] of expectedMappedSlides.entries()) {
expect(getActiveReviewer(container)).toBe(slide.reviewer);
expect(getActiveImage(container).getAttribute('src')).toBe(slide.src);
expect(getActiveImage(container)).toBeTruthy();
if (index < expectedMappedSlides.length - 1) {
await fireEvent.click(nextButton);
@@ -52,7 +60,7 @@ describe('TestimonialsSection', () => {
testimonials: homepageContent.testimonials
});
const nextButton = screen.getByRole('button', { name: /next testimonial/i });
const nextButton = getNextButton(container);
expect(getActiveReviewer(container)).toBe('Kate');
@@ -68,16 +76,14 @@ describe('TestimonialsSection', () => {
testimonials: homepageContent.testimonials
});
const previousButton = screen.getByRole('button', { name: /previous testimonial/i });
const previousButton = getPreviousButton(container);
expect(getActiveReviewer(container)).toBe('Kate');
await fireEvent.click(previousButton);
expect(getActiveReviewer(container)).toBe('Nina');
expect(getActiveImage(container).getAttribute('src')).toBe(
'/images/wallace-auckland-dog-walking-review.png'
);
expect(getActiveImage(container)).toBeTruthy();
});
it('keeps custom testimonial images and filters out testimonials with no image', async () => {
@@ -100,7 +106,7 @@ describe('TestimonialsSection', () => {
testimonials: customTestimonials
});
const nextButton = screen.getByRole('button', { name: /next testimonial/i });
const nextButton = getNextButton(container);
expect(container.querySelectorAll('.testimonial-slide')).toHaveLength(5);
@@ -109,7 +115,16 @@ describe('TestimonialsSection', () => {
}
expect(getActiveReviewer(container)).toBe('Casey');
expect(getActiveImage(container).getAttribute('src')).toBe('/images/custom-casey-review.png');
expect(getActiveImage(container)).toBeTruthy();
expect(screen.queryByText('Jordan')).not.toBeInTheDocument();
});
it('can start on a different testimonial for a different page seed', () => {
const { container } = render(TestimonialsSection, {
testimonials: homepageContent.testimonials,
seedKey: '/dog-walking'
});
expect(getActiveReviewer(container)).not.toBe('Kate');
});
});