Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Enriqe committed Jan 29, 2021
1 parent 10ef1c6 commit cded821
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test/unit/test-amp-story-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ describes.realWin('AmpStoryPlayer', {amp: false}, (env) => {
.resolves(fakeMessaging);
});

afterEach(() => {
console.error.restore();
});

it('should build an iframe for each story', async () => {
buildStoryPlayer();
await manager.loadPlayers();
Expand Down Expand Up @@ -449,10 +453,17 @@ describes.realWin('AmpStoryPlayer', {amp: false}, (env) => {
});

it('should throw error when invalid url is provided', async () => {
buildStoryPlayer(1, DEFAULT_ORIGIN_URL, 'www.invalid.org');
console.error.restore();
env.sandbox.spy(console, 'error');

buildStoryPlayer(1, DEFAULT_ORIGIN_URL, 'www.tacos.org');

await manager.loadPlayers();
await nextTick();

return expect(() => manager.loadPlayers()).to.throw(
/Unsupported cache, use one of following: cdn.ampproject.org,www.bing-amp.com/
expect(console.error).to.be.calledWithMatch(
/\[amp-story-player\]/,
/Unsupported cache specified, use one of following: cdn.ampproject.org,www.bing-amp.com/
);
});
});
Expand Down

0 comments on commit cded821

Please sign in to comment.