Skip to content

Commit

Permalink
adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
odalys-dataport committed Oct 13, 2023
1 parent 966f01c commit 81c28cc
Showing 1 changed file with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ describe("SubmissionItemsTeacherDisplay", () => {

describe("when a filter is clicked", () => {
let wrapper: Wrapper<Vue>;
const submissions = [
{ firstName: "Max", lastName: "Meyer", status: "open" },
{ firstName: "Sabrina", lastName: "Schulz", status: "completed" },
];

beforeAll(() => {
const submissions = [
{ firstName: "Max", lastName: "Meyer", status: "open" },
{ firstName: "Sabrina", lastName: "Schulz", status: "completed" },
];
wrapper = setup(submissions).wrapper;
});

Expand All @@ -197,16 +197,10 @@ describe("SubmissionItemsTeacherDisplay", () => {
expect(chip.exists()).toBe(true);

await chip.trigger("click");
// also wait for next rendering
await nextTick();

const tableContent = wrapper.find(".v-expansion-panel-content");
expect(tableContent.exists()).toBe(true);

// dont get first tr (skip the one in table head)
const submissionItems = tableContent.findAll("tbody > tr");

expect(submissionItems).toHaveLength(1);
});

it("should only show filtered submissions", async () => {
Expand All @@ -222,11 +216,7 @@ describe("SubmissionItemsTeacherDisplay", () => {
expect(tableContent.exists()).toBe(true);

const submissionItems = tableContent.findAll("tbody > tr");

const filteredSubmissions = submissions.filter(
(submission) => submission.status === "open"
);
expect(submissionItems).toHaveLength(filteredSubmissions.length);
expect(submissionItems).toHaveLength(1);
});
});
});

0 comments on commit 81c28cc

Please sign in to comment.