@amazon/vinyl 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1308,6 +1308,42 @@ describe('TrackControllerImpl', () => {
1308
1308
  expect(trackActivated).toHaveBeenCalledWith(objectContaining({ track: objectContaining({ uri: main.uri }) }));
1309
1309
  expect(trackActivated).toHaveBeenCalledBefore(queueEnded);
1310
1310
  });
1311
+ it('ends the track after an empty postroll where no ad ever began', async () => {
1312
+ // An empty postroll (a break that resolves to no ads) completes
1313
+ // without any adEntered, so the content track is never deactivated
1314
+ // and stays active. onEnded has already deferred the trackEnded to
1315
+ // adBreakCompleted, so this must still end the track and the queue
1316
+ // rather than hang.
1317
+ const [main] = createLoadOptionsList(1);
1318
+ trackController.load(main);
1319
+ await clock.tick(); // content activates (stays active — no ad plays)
1320
+ expect(trackController.activeTrack.active).toBeTrue();
1321
+ const trackEnded = createEventSpy(trackController, 'trackEnded');
1322
+ const queueEnded = createEventSpy(trackController, 'queueEnded');
1323
+ deps.adController.dispatch('adBreakCompleted', {
1324
+ adBreak: adBreak('postroll'),
1325
+ resumePosition: 0,
1326
+ });
1327
+ await clock.tick();
1328
+ expect(trackEnded).toHaveBeenCalledWith(objectContaining({
1329
+ track: objectContaining({ uri: main.uri }),
1330
+ }));
1331
+ expect(queueEnded).toHaveBeenCalled();
1332
+ });
1333
+ it('advances to the next track after an empty postroll where no ad ever began', async () => {
1334
+ const list = createLoadOptionsList(2);
1335
+ trackController.load(...list);
1336
+ await clock.tick(); // content activates and stays active
1337
+ expect(trackController.activeTrack.active).toBeTrue();
1338
+ const trackEnded = createEventSpy(trackController, 'trackEnded');
1339
+ deps.adController.dispatch('adBreakCompleted', {
1340
+ adBreak: adBreak('postroll'),
1341
+ resumePosition: 0,
1342
+ });
1343
+ await clock.tick();
1344
+ expect(trackEnded).toHaveBeenCalledWith(objectContaining({ track: any(Object) }));
1345
+ expect(trackController.activeTrack?.uri).toBe(list[1].uri);
1346
+ });
1311
1347
  it('does not treat a completed midroll ad as the track ending', async () => {
1312
1348
  trackController.load(...createLoadOptionsList(1));
1313
1349
  const trackEnded = createEventSpy(trackController, 'trackEnded');