Remove support for ignore property
This commit is contained in:
		
							parent
							
								
									55c60ef49c
								
							
						
					
					
						commit
						9e5788214a
					
				| 
						 | 
					@ -94,7 +94,6 @@ module.exports = {
 | 
				
			||||||
  lang: 'fr', // default language for all programs (default: 'en')
 | 
					  lang: 'fr', // default language for all programs (default: 'en')
 | 
				
			||||||
  days: 3, // number of days for which to grab the program (default: 1)
 | 
					  days: 3, // number of days for which to grab the program (default: 1)
 | 
				
			||||||
  delay: 5000, // delay between requests (default: 3000)
 | 
					  delay: 5000, // delay between requests (default: 3000)
 | 
				
			||||||
  ignore: true, // skip all channels during request (default: false)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  request: { // request options (details: https://github.com/axios/axios#request-config)
 | 
					  request: { // request options (details: https://github.com/axios/axios#request-config)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -14,12 +14,6 @@ module.exports = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let programs = []
 | 
					    let programs = []
 | 
				
			||||||
    for (let item of queue) {
 | 
					    for (let item of queue) {
 | 
				
			||||||
      if (config.ignore) {
 | 
					 | 
				
			||||||
        item.programs = []
 | 
					 | 
				
			||||||
        cb(item, new Error('Skipped'))
 | 
					 | 
				
			||||||
        continue
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      await utils
 | 
					      await utils
 | 
				
			||||||
        .buildRequest(item, config)
 | 
					        .buildRequest(item, config)
 | 
				
			||||||
        .then(request => utils.fetchData(request))
 | 
					        .then(request => utils.fetchData(request))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,23 +71,3 @@ it('can grab single channel programs', done => {
 | 
				
			||||||
      done()
 | 
					      done()
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					 | 
				
			||||||
it('return "Skipped" error if ignore option in config is true', done => {
 | 
					 | 
				
			||||||
  const config = {
 | 
					 | 
				
			||||||
    site: 'example.com',
 | 
					 | 
				
			||||||
    ignore: true,
 | 
					 | 
				
			||||||
    url: `http://example.com/20210319/1tv.json`,
 | 
					 | 
				
			||||||
    parser: () => []
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  const channel = {
 | 
					 | 
				
			||||||
    site: 'example.com',
 | 
					 | 
				
			||||||
    site_id: 'cnn',
 | 
					 | 
				
			||||||
    xmltv_id: 'CNN.us',
 | 
					 | 
				
			||||||
    lang: 'en',
 | 
					 | 
				
			||||||
    name: 'CNN'
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  grabber.grab(channel, config, (data, err) => {
 | 
					 | 
				
			||||||
    expect(err.message).toBe('Skipped')
 | 
					 | 
				
			||||||
    done()
 | 
					 | 
				
			||||||
  })
 | 
					 | 
				
			||||||
})
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,7 +5,6 @@ dayjs.extend(utc)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
  site: 'example.com',
 | 
					  site: 'example.com',
 | 
				
			||||||
  ignore: true,
 | 
					 | 
				
			||||||
  channels: 'example.com.channels.xml',
 | 
					  channels: 'example.com.channels.xml',
 | 
				
			||||||
  output: 'tests/output/guide.xml',
 | 
					  output: 'tests/output/guide.xml',
 | 
				
			||||||
  url: () => 'http://example.com/20210319/1tv.json',
 | 
					  url: () => 'http://example.com/20210319/1tv.json',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,5 @@
 | 
				
			||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
  site: 'example.com',
 | 
					  site: 'example.com',
 | 
				
			||||||
  ignore: true,
 | 
					 | 
				
			||||||
  url: 'http://example.com/20210319/1tv.json',
 | 
					  url: 'http://example.com/20210319/1tv.json',
 | 
				
			||||||
  parser: () => []
 | 
					  parser: () => []
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,7 +7,6 @@ it('can load valid config.js', () => {
 | 
				
			||||||
  const config = utils.loadConfig(require(path.resolve('./tests/input/example.com.config.js')))
 | 
					  const config = utils.loadConfig(require(path.resolve('./tests/input/example.com.config.js')))
 | 
				
			||||||
  expect(config).toMatchObject({
 | 
					  expect(config).toMatchObject({
 | 
				
			||||||
    days: 1,
 | 
					    days: 1,
 | 
				
			||||||
    ignore: true,
 | 
					 | 
				
			||||||
    delay: 3000,
 | 
					    delay: 3000,
 | 
				
			||||||
    lang: 'en',
 | 
					    lang: 'en',
 | 
				
			||||||
    site: 'example.com'
 | 
					    site: 'example.com'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue