Skip to content

Commit

Permalink
add unit test cases if the members are 'roomowner'
Browse files Browse the repository at this point in the history
  • Loading branch information
muratmerdoglu-dp committed Dec 16, 2024
1 parent 4ae07d6 commit 5fc9839
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/modules/feature/room/RoomMembers/MembersTable.unit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
createTestingVuetify,
} from "@@/tests/test-utils/setup";
import MembersTable from "./MembersTable.vue";
import { ref } from "vue";
import { nextTick, ref } from "vue";
import { mdiMenuDown, mdiMenuUp, mdiMagnify } from "@icons/material";
import { roomMemberFactory } from "@@/tests/test-utils";
import { DOMWrapper, VueWrapper } from "@vue/test-utils";
Expand Down Expand Up @@ -345,6 +345,41 @@ describe("MembersTable", () => {

expect(wrapper.emitted()).not.toHaveProperty("remove:members");
});

describe("when members are 'roomowner'", () => {
const ownerMembers = roomMemberFactory(RoleName.Roomowner)
.buildList(3)
.map((member) => ({ ...member, isSelectable: false }));

it("should not render remove button for room owner", async () => {
const { wrapper } = setup();

wrapper.setProps({ members: ownerMembers });
await nextTick();

const dataTable = wrapper.getComponent(VDataTable);
const removeButton = dataTable.findComponent(
"[data-testid=remove-member-0]"
);

expect(removeButton.exists()).toBe(false);
});

it("members should not be selectable", async () => {
const { wrapper } = setup();

wrapper.setProps({ members: ownerMembers });
await nextTick();

const dataTable = wrapper.getComponent(VDataTable);

const checkboxes = dataTable.findAllComponents({
name: "VSelectionControl",
});

expect(checkboxes[1].vm.disabled).toBe(true);
});
});
});
});

Expand Down

0 comments on commit 5fc9839

Please sign in to comment.