Skip to content

Commit

Permalink
Tests AddOnListItem
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Apr 23, 2024
1 parent 83afd29 commit fb84f01
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/lib/components/addons/AddOnListItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { _ } from "svelte-i18n";
import AddOnPin from "@/addons/AddOnPin.svelte";
import AddOnPopularity from "@/addons/Popularity.svelte";
import PremiumBadge from "@/premium-credits/PremiumBadge.svelte";
export let addon: AddOnListItem;
Expand Down Expand Up @@ -35,11 +34,8 @@
>
</p>
{/if}
{#if addon.usage}
<AddOnPopularity useCount={addon.usage} />
{/if}
{#if isPremium}
<span class="badge"><PremiumBadge /></span>
<span class="badge" role="status"><PremiumBadge /></span>
{/if}
</div>
</div>
Expand Down
11 changes: 11 additions & 0 deletions src/lib/components/addons/tests/AddOnListItem.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { test, expect } from "vitest";
import { render } from "@testing-library/svelte";
import AddOnListItem from "../AddOnListItem.svelte";
import { addon, premiumAddon } from "@/test/fixtures/addons";

test("AddOnListItem", () => {
const result = render(AddOnListItem, { addon });
expect(result.getByRole("heading")).toHaveTextContent(addon.name);
const premium = render(AddOnListItem, { addon: premiumAddon });
expect(premium.getByRole("status")).toBeInTheDocument();
});

0 comments on commit fb84f01

Please sign in to comment.