Skip to content

Commit

Permalink
Updates icon handling in tests
Browse files Browse the repository at this point in the history
Replaces stubbed icon component with FontAwesomeIcon in ActivitySettings test
Changes icon property type to IconDefinition in activityStore test for type safety
  • Loading branch information
itisAliRH authored and dannon committed Dec 3, 2024
1 parent f461d7c commit 6640b28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client/src/components/ActivityBar/ActivitySettings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe("ActivitySettings", () => {
activityBarId: undefined,
},
stubs: {
icon: { template: "<div></div>" },
FontAwesomeIcon: { template: "<div></div>" },
},
});
await activityStore.sync();
Expand Down Expand Up @@ -102,7 +102,7 @@ describe("ActivitySettings", () => {
await wrapper.vm.$nextTick();
const items = wrapper.findAll(activityItemSelector);
expect(items.length).toBe(1);
const trash = items.at(0).find("[data-icon='trash']");
const trash = items.at(0).find("[data-description='delete activity']");
expect(trash.exists()).toBeTruthy();
expect(activityStore.getAll().length).toBe(1);
trash.trigger("click");
Expand Down
7 changes: 4 additions & 3 deletions client/src/stores/activityStore.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { type IconDefinition } from "@fortawesome/fontawesome-svg-core";
import { createPinia, setActivePinia } from "pinia";

import { useActivityStore } from "@/stores/activityStore";
Expand All @@ -8,7 +9,7 @@ jest.mock("./activitySetup", () => ({
{
anonymous: false,
description: "a-description",
icon: "a-icon",
icon: "a-icon" as unknown as IconDefinition,
id: "a-id",
mutable: false,
optional: false,
Expand All @@ -25,7 +26,7 @@ const newActivities = [
{
anonymous: false,
description: "a-description-new",
icon: "a-icon-new",
icon: "a-icon-new" as unknown as IconDefinition,
id: "a-id",
mutable: false,
optional: false,
Expand All @@ -38,7 +39,7 @@ const newActivities = [
{
anonymous: false,
description: "b-description-new",
icon: "b-icon-new",
icon: "b-icon-new" as unknown as IconDefinition,
id: "b-id",
mutable: true,
optional: false,
Expand Down

0 comments on commit 6640b28

Please sign in to comment.