Skip to content

Commit

Permalink
test: Readable order for ad test setup (#5468)
Browse files Browse the repository at this point in the history
For readability, the order of before*/after* functions should be the
same as their execution order:
 - beforeAll
 - beforeEach
 - afterEach
 - afterAll

This fixes the order for ad tests.
  • Loading branch information
joeyparrish authored Aug 15, 2023
1 parent b51ee6e commit c42eaa7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/ui/ad_ui_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ describe('Ad UI', () => {
shaka.Player.setAdManagerFactory(() => new shaka.test.FakeAdManager());
});

afterEach(async () => {
await UiUtils.cleanupUI();
});

afterAll(() => {
document.head.removeChild(cssLink);
shaka.Player.setAdManagerFactory(() => new shaka.ads.AdManager());
});

beforeEach(() => {
container =
/** @type {!HTMLElement} */ (document.createElement('div'));
Expand All @@ -45,6 +36,15 @@ describe('Ad UI', () => {
adManager = video['ui'].getControls().getPlayer().getAdManager();
});

afterEach(async () => {
await UiUtils.cleanupUI();
});

afterAll(() => {
document.head.removeChild(cssLink);
shaka.Player.setAdManagerFactory(() => new shaka.ads.AdManager());
});

it('is invisible if no ad is playing', () => {
const adControlsContainer =
UiUtils.getElementByClassName(container, 'shaka-ad-controls');
Expand Down

0 comments on commit c42eaa7

Please sign in to comment.