Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
|
469c0cb206 | ||
|
3f8796c74c |
3 changed files with 28 additions and 5 deletions
|
@ -3,11 +3,12 @@ const chai = require('chai')
|
||||||
chai.use(require('chai-as-promised'))
|
chai.use(require('chai-as-promised'))
|
||||||
const assert = chai.assert
|
const assert = chai.assert
|
||||||
|
|
||||||
|
const exampleName = 'empty'
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
const url = 'https://boyska.degenerazione.xyz/radiomanifest/examples/empty/'
|
const url = 'https://boyska.degenerazione.xyz/radiomanifest/examples/' + exampleName + '/'
|
||||||
|
|
||||||
describe('radiomanifest.js', () => {
|
describe('examples/' + exampleName, () => {
|
||||||
describe('Get empty radiomanifest', () => {
|
describe('Get radiomanifest', () => {
|
||||||
it('should return a Promise', () => {
|
it('should return a Promise', () => {
|
||||||
const p = radiomanifest.get(url)
|
const p = radiomanifest.get(url)
|
||||||
expect(p instanceof Promise).to.be.eql(true)
|
expect(p instanceof Promise).to.be.eql(true)
|
||||||
|
|
22
test/example-source404.test.js
Normal file
22
test/example-source404.test.js
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const radiomanifest = require('../radiomanifest.js')
|
||||||
|
const chai = require('chai')
|
||||||
|
chai.use(require('chai-as-promised'))
|
||||||
|
const assert = chai.assert
|
||||||
|
|
||||||
|
const exampleName = 'stream404'
|
||||||
|
const expect = chai.expect
|
||||||
|
const url = 'https://boyska.degenerazione.xyz/radiomanifest/examples/' + exampleName + '/'
|
||||||
|
|
||||||
|
describe('examples/' + exampleName, () => {
|
||||||
|
describe('streaming', () => {
|
||||||
|
it('shoud return one streaming option', async () => {
|
||||||
|
const p = await radiomanifest.get(url)
|
||||||
|
expect(p.getStreaming().getOptions().length).to.be.equal(1)
|
||||||
|
})
|
||||||
|
it('... whose url is stream.m3u', async () => {
|
||||||
|
const p = await radiomanifest.get(url)
|
||||||
|
expect(p.getStreaming().getOptions()[0]).to.be.equal(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
|
@ -7,12 +7,12 @@ const expect = chai.expect
|
||||||
describe('radiomanifest.js', () => {
|
describe('radiomanifest.js', () => {
|
||||||
describe('Get a radiomanifest', () => {
|
describe('Get a radiomanifest', () => {
|
||||||
it('should return a Promise', () => {
|
it('should return a Promise', () => {
|
||||||
const p = radiomanifest.get('http://omstring')
|
const p = radiomanifest.get('http://example.com/')
|
||||||
expect(p instanceof Promise).to.be.eql(true)
|
expect(p instanceof Promise).to.be.eql(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reject on invalid URL', () => {
|
it('should reject on invalid URL', () => {
|
||||||
const p = radiomanifest.get('http://invalidurl')
|
const p = radiomanifest.get('http://example.com/')
|
||||||
expect(p).to.eventually.be.rejected
|
expect(p).to.eventually.be.rejected
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue