iptv/tests/commands/create-matrix.test.js

21 lines
590 B
JavaScript
Raw Normal View History

2021-12-12 05:13:02 +01:00
const fs = require('fs')
const path = require('path')
const { execSync } = require('child_process')
beforeEach(() => {
2022-02-05 05:27:25 +01:00
fs.copyFileSync('tests/__data__/input/streams.db', 'tests/__data__/temp/streams.db')
2021-12-12 05:13:02 +01:00
})
afterEach(() => {
fs.rmdirSync('tests/__data__/temp', { recursive: true })
fs.mkdirSync('tests/__data__/temp')
})
it('can create valid matrix', () => {
const result = execSync(
2022-02-05 05:27:25 +01:00
'DB_FILEPATH=tests/__data__/temp/streams.db node scripts/commands/create-matrix.js',
2021-12-12 05:13:02 +01:00
{ encoding: 'utf8' }
)
expect(result).toBe('::set-output name=matrix::{"cluster_id":[1,3]}\n')
})