From d5e0e6d006295e81a5b06dab94881c69db83d01b Mon Sep 17 00:00:00 2001 From: Asli Aykan Date: Mon, 9 Dec 2024 14:53:15 +0100 Subject: [PATCH] resolved conflict --- .../post-footer/post-footer.component.spec.ts | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/test/javascript/spec/component/shared/metis/postings-footer/post-footer/post-footer.component.spec.ts b/src/test/javascript/spec/component/shared/metis/postings-footer/post-footer/post-footer.component.spec.ts index 1f7e454597e1..353df5e83415 100644 --- a/src/test/javascript/spec/component/shared/metis/postings-footer/post-footer/post-footer.component.spec.ts +++ b/src/test/javascript/spec/component/shared/metis/postings-footer/post-footer/post-footer.component.spec.ts @@ -80,8 +80,8 @@ describe('PostFooterComponent', () => { runInInjectionContext(injector, () => { component.sortedAnswerPosts = input(unsortedAnswerArray); component.groupAnswerPosts(); - expect(component.groupedAnswerPosts.length).toBeGreaterThan(0); // Ensure groups are created - expect(component.groupedAnswerPosts[0].posts.length).toBeGreaterThan(0); // Ensure posts exist in groups + expect(component.groupedAnswerPosts.length).toBeGreaterThan(0); + expect(component.groupedAnswerPosts[0].posts.length).toBeGreaterThan(0); }); }); @@ -189,27 +189,28 @@ describe('PostFooterComponent', () => { const post3: AnswerPost = { id: 3, author: authorA, creationDate: baseTime.add(10, 'minute').toDate() } as unknown as AnswerPost; const post4: AnswerPost = { id: 4, author: authorB, creationDate: baseTime.add(12, 'minute').toDate() } as unknown as AnswerPost; const post5: AnswerPost = { id: 5, author: authorB, creationDate: baseTime.add(14, 'minute').toDate() } as unknown as AnswerPost; + runInInjectionContext(injector, () => { + component.sortedAnswerPosts = input([post3, post1, post5, post2, post4]); - component.sortedAnswerPosts = [post3, post1, post5, post2, post4]; - - component.groupAnswerPosts(); - expect(component.groupedAnswerPosts).toHaveLength(3); - - const group1 = component.groupedAnswerPosts[0]; - expect(group1.author).toEqual(authorA); - expect(group1.posts).toHaveLength(2); - expect(group1.posts).toContainEqual(expect.objectContaining({ id: post1.id })); - expect(group1.posts).toContainEqual(expect.objectContaining({ id: post2.id })); - - const group2 = component.groupedAnswerPosts[1]; - expect(group2.author).toEqual(authorA); - expect(group2.posts).toHaveLength(1); - expect(group2.posts).toContainEqual(expect.objectContaining({ id: post3.id })); - - const group3 = component.groupedAnswerPosts[2]; - expect(group3.author).toEqual(authorB); - expect(group3.posts).toHaveLength(2); - expect(group3.posts).toContainEqual(expect.objectContaining({ id: post4.id })); - expect(group3.posts).toContainEqual(expect.objectContaining({ id: post5.id })); + component.groupAnswerPosts(); + expect(component.groupedAnswerPosts).toHaveLength(3); + + const group1 = component.groupedAnswerPosts[0]; + expect(group1.author).toEqual(authorA); + expect(group1.posts).toHaveLength(2); + expect(group1.posts).toContainEqual(expect.objectContaining({ id: post1.id })); + expect(group1.posts).toContainEqual(expect.objectContaining({ id: post2.id })); + + const group2 = component.groupedAnswerPosts[1]; + expect(group2.author).toEqual(authorA); + expect(group2.posts).toHaveLength(1); + expect(group2.posts).toContainEqual(expect.objectContaining({ id: post3.id })); + + const group3 = component.groupedAnswerPosts[2]; + expect(group3.author).toEqual(authorB); + expect(group3.posts).toHaveLength(2); + expect(group3.posts).toContainEqual(expect.objectContaining({ id: post4.id })); + expect(group3.posts).toContainEqual(expect.objectContaining({ id: post5.id })); + }); }); });