Update bin.test.js
This commit is contained in:
		
							parent
							
								
									cccda9fb39
								
							
						
					
					
						commit
						0a83492b76
					
				| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
const { execSync } = require('child_process')
 | 
					const { execSync } = require('child_process')
 | 
				
			||||||
const fs = require('fs')
 | 
					const fs = require('fs-extra')
 | 
				
			||||||
const path = require('path')
 | 
					const path = require('path')
 | 
				
			||||||
const epgParser = require('epg-parser')
 | 
					const epgParser = require('epg-parser')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,6 +11,10 @@ function stdoutResultTester(stdout) {
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					beforeEach(() => {
 | 
				
			||||||
 | 
					  fs.emptyDirSync('tests/__data__/output')
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
it('can load config', () => {
 | 
					it('can load config', () => {
 | 
				
			||||||
  const stdout = execSync(
 | 
					  const stdout = execSync(
 | 
				
			||||||
    `node ${pwd}/bin/epg-grabber.js --config=tests/__data__/input/example.config.js --delay=0`,
 | 
					    `node ${pwd}/bin/epg-grabber.js --config=tests/__data__/input/example.config.js --delay=0`,
 | 
				
			||||||
| 
						 | 
					@ -62,6 +66,26 @@ it('can generate gzip version', () => {
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					it('can produce multiple outputs', () => {
 | 
				
			||||||
 | 
					  const stdout = execSync(
 | 
				
			||||||
 | 
					    `node ${pwd}/bin/epg-grabber.js \
 | 
				
			||||||
 | 
					      --config=tests/__data__/input/mini.config.js \
 | 
				
			||||||
 | 
					      --channels=tests/__data__/input/example.channels.xml \
 | 
				
			||||||
 | 
					      --output=tests/__data__/output/{lang}/{id}.xml`,
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      encoding: 'utf8'
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  expect(stdoutResultTester(stdout)).toBe(true)
 | 
				
			||||||
 | 
					  expect(stdout.includes("File 'tests/__data__/output/fr/1TV.com.xml' successfully saved")).toBe(
 | 
				
			||||||
 | 
					    true
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					  expect(
 | 
				
			||||||
 | 
					    stdout.includes("File 'tests/__data__/output/undefined/2TV.com.xml' successfully saved")
 | 
				
			||||||
 | 
					  ).toBe(true)
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
it('removes duplicates of the program', () => {
 | 
					it('removes duplicates of the program', () => {
 | 
				
			||||||
  const stdout = execSync(
 | 
					  const stdout = execSync(
 | 
				
			||||||
    `node ${pwd}/bin/epg-grabber.js \
 | 
					    `node ${pwd}/bin/epg-grabber.js \
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue