Skip to content

Commit

Permalink
update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyundai committed Oct 29, 2024
1 parent acb3d8d commit bd48461
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/unit/scripts/content-update.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,19 @@ describe('updateRSVPButtonState', () => {
originalText: 'RSVP',
};

let eventInfo = { isFull: false };
BlockMediator.set('eventData', { isFull: false });

await updateRSVPButtonState(rsvpBtn, LIBS, eventInfo);
await updateRSVPButtonState(rsvpBtn, LIBS);
expect(rsvpBtn.el.textContent).to.equal('RSVP');

eventInfo = { isFull: true };
await updateRSVPButtonState(rsvpBtn, LIBS, eventInfo);
BlockMediator.set('rsvpData', { ok: false, error: { message: 'Request to ESP failed: Event is full' } });
await updateRSVPButtonState(rsvpBtn, LIBS, eventInfo);
BlockMediator.set('eventData', { isFull: true, allowWaitlisting: false });
await updateRSVPButtonState(rsvpBtn, LIBS);
expect(rsvpBtn.el.classList.contains('disabled')).to.be.true;

BlockMediator.set('eventData', { isFull: true, allowWaitlisting: true });
await updateRSVPButtonState(rsvpBtn, LIBS);
expect(rsvpBtn.el.classList.contains('disabled')).to.be.false;
});
});

Expand Down

0 comments on commit bd48461

Please sign in to comment.