Skip to content

Commit

Permalink
test(frontend): 🧪 write component test for sharebuttons (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
luctra02 authored and GitHub committed Apr 21, 2024
1 parent 00ce42c commit 3681e85
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions frontend/tests/componentTests/sharebuttons.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Import necessary dependencies
import { test, expect } from "@playwright/experimental-ct-react";
import ShareButtons from "@/components/ShareButtons";

// Define the test
test("Check ShareButtons component", async ({ mount }) => {
// Mock slug
const slug = "test-slug";

// Mount the ShareButtons component
const component = await mount(<ShareButtons slug={slug} />);

// Check if Facebook icon is rendered
const facebookButton = component.getByLabel("facebook");
await expect(facebookButton).toBeVisible();

// Check if Linkedin icon is rendered
const linkedinButton = component.getByLabel("linkedin");
await expect(linkedinButton).toBeVisible();

// Check if Twitter icon is rendered
const twitterButton = component.getByLabel("twitter");
await expect(twitterButton).toBeVisible();
});
File renamed without changes.
File renamed without changes.

0 comments on commit 3681e85

Please sign in to comment.