mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 10:30:03 -04:00
Create export.test.js
This commit is contained in:
parent
450258d1cf
commit
9fe1e4a7a6
1 changed files with 25 additions and 0 deletions
25
tests/commands/database/export.test.js
Normal file
25
tests/commands/database/export.test.js
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
const { execSync } = require('child_process')
|
||||||
|
const fs = require('fs-extra')
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fs.emptyDirSync('tests/__data__/output')
|
||||||
|
fs.copyFileSync(
|
||||||
|
'tests/__data__/input/database/base_streams.db',
|
||||||
|
'tests/__data__/output/streams.db'
|
||||||
|
)
|
||||||
|
|
||||||
|
const stdout = execSync(
|
||||||
|
'DB_DIR=tests/__data__/output PUBLIC_DIR=tests/__data__/output/.gh-pages npm run db:export',
|
||||||
|
{ encoding: 'utf8' }
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can create streams.json', () => {
|
||||||
|
expect(content(`output/.gh-pages/streams.json`)).toBe(content(`expected/.gh-pages/streams.json`))
|
||||||
|
})
|
||||||
|
|
||||||
|
function content(filepath) {
|
||||||
|
return fs.readFileSync(`tests/__data__/${filepath}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
})
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue