iptv/tests/commands/database/matrix.test.js

22 lines
648 B
JavaScript
Raw Normal View History

2022-02-12 02:27:39 +01:00
const fs = require('fs-extra')
const path = require('path')
const { execSync } = require('child_process')
beforeEach(() => {
fs.emptyDirSync('tests/__data__/output')
2022-08-15 01:22:01 +02:00
fs.mkdirSync('tests/__data__/output/database')
2022-02-12 02:27:39 +01:00
fs.copyFileSync(
2022-02-15 00:59:19 +01:00
'tests/__data__/input/database/db_matrix.streams.db',
2022-08-15 01:22:01 +02:00
'tests/__data__/output/database/streams.db'
2022-02-12 02:27:39 +01:00
)
})
it('can create valid matrix', () => {
2022-08-15 01:22:01 +02:00
const result = execSync('DB_DIR=tests/__data__/output/database npm run db:matrix', {
2022-02-12 02:27:39 +01:00
encoding: 'utf8'
})
expect(result).toBe(
'\n> db:matrix\n> node scripts/commands/database/matrix.js\n\n::set-output name=matrix::{"cluster_id":[1,3]}\n'
)
})