Compare commits

...

2 commits

Author SHA1 Message Date
boyska
469c0cb206 new tests for source404 2021-12-05 16:52:32 +01:00
boyska
3f8796c74c refactor tests 2021-12-05 16:52:19 +01:00
3 changed files with 28 additions and 5 deletions

View file

@ -3,11 +3,12 @@ const chai = require('chai')
chai.use(require('chai-as-promised'))
const assert = chai.assert
const exampleName = 'empty'
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('Get empty radiomanifest', () => {
describe('examples/' + exampleName, () => {
describe('Get radiomanifest', () => {
it('should return a Promise', () => {
const p = radiomanifest.get(url)
expect(p instanceof Promise).to.be.eql(true)

View 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)
})
})
})

View file

@ -7,12 +7,12 @@ const expect = chai.expect
describe('radiomanifest.js', () => {
describe('Get a radiomanifest', () => {
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)
})
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
})
})