From 7cb78fef0150a2dbe429e74c7adc7cf575a23b2b Mon Sep 17 00:00:00 2001 From: Ian Silva Date: Thu, 14 Dec 2023 22:54:56 -0300 Subject: [PATCH] fix: review wio web-component tests --- .../who-is-online/who-is-online.test.ts | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/web-components/who-is-online/who-is-online.test.ts b/src/web-components/who-is-online/who-is-online.test.ts index e9a88b76..0d376379 100644 --- a/src/web-components/who-is-online/who-is-online.test.ts +++ b/src/web-components/who-is-online/who-is-online.test.ts @@ -213,8 +213,8 @@ describe('Who Is Online', () => { }); test('should stop following if already following', async () => { - const event = new CustomEvent(RealtimeEvent.REALTIME_FOLLOW_PARTICIPANT, { - detail: { id: 1, label: WIODropdownOptions.FOLLOW, slotIndex: 0 }, + const event = new CustomEvent(RealtimeEvent.REALTIME_LOCAL_FOLLOW_PARTICIPANT, { + detail: { id: 1, label: WIODropdownOptions.LOCAL_FOLLOW, slotIndex: 0 }, }); element['dropdownOptionsHandler'](event); @@ -246,8 +246,8 @@ describe('Who Is Online', () => { 1, ); - const event = new CustomEvent(RealtimeEvent.REALTIME_FOLLOW_PARTICIPANT, { - detail: { id: 'test', label: WIODropdownOptions.FOLLOW, slotIndex: 2 }, + const event = new CustomEvent(RealtimeEvent.REALTIME_LOCAL_FOLLOW_PARTICIPANT, { + detail: { id: 'test', label: WIODropdownOptions.LOCAL_FOLLOW, slotIndex: 2 }, }); element['dropdownOptionsHandler'](event); @@ -280,11 +280,11 @@ describe('Who Is Online', () => { test('should emit event when selecting follow option in dropdown', async () => { const event = new CustomEvent('selected', { - detail: { id: 1, label: WIODropdownOptions.FOLLOW, slotIndex: 1 }, + detail: { id: 1, label: WIODropdownOptions.LOCAL_FOLLOW, slotIndex: 1 }, }); const spy = jest.fn(); - element.addEventListener(RealtimeEvent.REALTIME_FOLLOW_PARTICIPANT, spy); + element.addEventListener(RealtimeEvent.REALTIME_LOCAL_FOLLOW_PARTICIPANT, spy); expect(element['following']).toBeUndefined(); @@ -296,11 +296,11 @@ describe('Who Is Online', () => { test('should emit event when selecting unfollow option in dropdown', async () => { const event = new CustomEvent('selected', { - detail: { id: 1, label: WIODropdownOptions.UNFOLLOW }, + detail: { id: 1, label: WIODropdownOptions.LOCAL_UNFOLLOW }, }); const spy = jest.fn(); - element.addEventListener(RealtimeEvent.REALTIME_FOLLOW_PARTICIPANT, spy); + element.addEventListener(RealtimeEvent.REALTIME_LOCAL_FOLLOW_PARTICIPANT, spy); element['following'] = { id: 1, slotIndex: 1 }; @@ -310,36 +310,36 @@ describe('Who Is Online', () => { expect(element['following']).toBeUndefined(); }); - test('should emit event when selecting gather option in dropdown', async () => { + test('should emit event when selecting follow option in dropdown', async () => { const event = new CustomEvent('selected', { - detail: { id: 1, label: WIODropdownOptions.GATHER, slotIndex: 1 }, + detail: { id: 1, label: WIODropdownOptions.FOLLOW, slotIndex: 1 }, }); const spy = jest.fn(); - element.addEventListener(RealtimeEvent.REALTIME_GATHER, spy); + element.addEventListener(RealtimeEvent.REALTIME_FOLLOW_PARTICIPANT, spy); element['following'] = { id: 1, slotIndex: 1 }; dropdown.dispatchEvent(event); expect(spy).toHaveBeenCalledWith(event); - expect(element['isGathering']).toBe(true); + expect(element['everyoneFollowsMe']).toBe(true); expect(element['following']).toBeUndefined(); }); - test('should emit event when selecting stop gather option in dropdown', async () => { + test('should emit event when selecting stop follow option in dropdown', async () => { const event = new CustomEvent('selected', { - detail: { id: 1, label: WIODropdownOptions.STOP_GATHER, slotIndex: 1 }, + detail: { id: 1, label: WIODropdownOptions.UNFOLLOW, slotIndex: 1 }, }); const spy = jest.fn(); - element.addEventListener(RealtimeEvent.REALTIME_GATHER, spy); - element['isGathering'] = true; + element.addEventListener(RealtimeEvent.REALTIME_FOLLOW_PARTICIPANT, spy); + element['everyoneFollowsMe'] = true; dropdown.dispatchEvent(event); expect(spy).toHaveBeenCalledWith(event); - expect(element['isGathering']).toBe(false); + expect(element['everyoneFollowsMe']).toBe(false); }); test('should emit event when selecting private mode option in dropdown', async () => {