Skip to content

Commit

Permalink
Better canPlay test grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
cookpete committed Apr 19, 2016
1 parent 0ce6c6b commit f528ade
Showing 1 changed file with 53 additions and 51 deletions.
104 changes: 53 additions & 51 deletions test/karma/canPlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,68 @@ import FilePlayer from '../../src/players/FilePlayer'

const { describe, it, expect } = window

describe('YouTube', () => {
it('knows what it can play', () => {
expect(YouTube.canPlay('https://www.youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('http://www.youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('https://youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('http://youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('http://youtu.be/12345678901')).to.be.true
})
describe('canPlay', () => {
describe('YouTube', () => {
it('knows what it can play', () => {
expect(YouTube.canPlay('https://www.youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('http://www.youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('https://youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('http://youtube.com/watch?v=12345678901')).to.be.true
expect(YouTube.canPlay('http://youtu.be/12345678901')).to.be.true
})

it('knows what it can\'t play', () => {
expect(YouTube.canPlay('http://soundcloud.com/artist-name/title-name')).to.be.false
expect(YouTube.canPlay('http://vimeo.com/1234')).to.be.false
it('knows what it can\'t play', () => {
expect(YouTube.canPlay('http://soundcloud.com/artist-name/title-name')).to.be.false
expect(YouTube.canPlay('http://vimeo.com/1234')).to.be.false
})
})
})

describe('SoundCloud', () => {
it('knows what it can play', () => {
expect(SoundCloud.canPlay('http://soundcloud.com/artist-name/title-name')).to.be.true
expect(SoundCloud.canPlay('http://soundcloud.com/artist_name/title_name')).to.be.true
expect(SoundCloud.canPlay('http://snd.sc/artist-name/title-name')).to.be.true
})
describe('SoundCloud', () => {
it('knows what it can play', () => {
expect(SoundCloud.canPlay('http://soundcloud.com/artist-name/title-name')).to.be.true
expect(SoundCloud.canPlay('http://soundcloud.com/artist_name/title_name')).to.be.true
expect(SoundCloud.canPlay('http://snd.sc/artist-name/title-name')).to.be.true
})

it('knows what it can\'t play', () => {
expect(SoundCloud.canPlay('http://soundcloud.com/artist-only')).to.be.false
expect(SoundCloud.canPlay('https://www.youtube.com/watch?v=12345678901')).to.be.false
expect(SoundCloud.canPlay('http://vimeo.com/1234')).to.be.false
it('knows what it can\'t play', () => {
expect(SoundCloud.canPlay('http://soundcloud.com/artist-only')).to.be.false
expect(SoundCloud.canPlay('https://www.youtube.com/watch?v=12345678901')).to.be.false
expect(SoundCloud.canPlay('http://vimeo.com/1234')).to.be.false
})
})
})

describe('Vimeo', () => {
it('knows what it can play', () => {
expect(Vimeo.canPlay('http://vimeo.com/1234')).to.be.true
})
describe('Vimeo', () => {
it('knows what it can play', () => {
expect(Vimeo.canPlay('http://vimeo.com/1234')).to.be.true
})

it('knows what it can\'t play', () => {
expect(Vimeo.canPlay('http://soundcloud.com/artist-name/title-name')).to.be.false
expect(Vimeo.canPlay('https://www.youtube.com/watch?v=1234')).to.be.false
it('knows what it can\'t play', () => {
expect(Vimeo.canPlay('http://soundcloud.com/artist-name/title-name')).to.be.false
expect(Vimeo.canPlay('https://www.youtube.com/watch?v=1234')).to.be.false
})
})
})

describe('FilePlayer', () => {
it('knows what it can play', () => {
expect(FilePlayer.canPlay('http://example.com/file.mp4')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogg')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogv')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.webm')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.mp3')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.wav')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.mp4?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogg?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogv?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.webm?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.mp3?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.wav?foo=1&bar=2')).to.be.true
})
describe('FilePlayer', () => {
it('knows what it can play', () => {
expect(FilePlayer.canPlay('http://example.com/file.mp4')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogg')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogv')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.webm')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.mp3')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.wav')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.mp4?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogg?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.ogv?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.webm?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.mp3?foo=1&bar=2')).to.be.true
expect(FilePlayer.canPlay('http://example.com/file.wav?foo=1&bar=2')).to.be.true
})

it('knows what it can\'t play', () => {
expect(FilePlayer.canPlay('http://example.com/file.mp5')).to.be.false
expect(FilePlayer.canPlay('http://example.com/file.ogh')).to.be.false
expect(FilePlayer.canPlay('http://example.com/file.web')).to.be.false
expect(FilePlayer.canPlay('http://example.com/file.txt')).to.be.false
it('knows what it can\'t play', () => {
expect(FilePlayer.canPlay('http://example.com/file.mp5')).to.be.false
expect(FilePlayer.canPlay('http://example.com/file.ogh')).to.be.false
expect(FilePlayer.canPlay('http://example.com/file.web')).to.be.false
expect(FilePlayer.canPlay('http://example.com/file.txt')).to.be.false
})
})
})

0 comments on commit f528ade

Please sign in to comment.