Files
epg/tests/commands/load-cluster.test.js

25 lines
711 B
JavaScript
Raw Normal View History

2022-01-06 16:01:23 +03:00
const fs = require('fs')
const path = require('path')
const { execSync } = require('child_process')
beforeEach(() => {
fs.rmdirSync('tests/__data__/output', { recursive: true })
fs.mkdirSync('tests/__data__/output')
})
it('can load cluster', () => {
const result = execSync(
2022-01-09 20:14:41 +03:00
'DB_DIR=tests/__data__/input/database LOGS_DIR=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1',
2022-01-06 16:01:23 +03:00
{ encoding: 'utf8' }
)
const logs = fs.readFileSync(
path.resolve('tests/__data__/output/logs/load-cluster/cluster_1.log'),
{
encoding: 'utf8'
}
)
const lines = logs.split('\n')
const parsed = JSON.parse(lines[0])
2022-01-09 18:15:38 +03:00
expect(parsed._id).toBe('K1kaxwsWVjsRIZL6')
2022-01-06 16:01:23 +03:00
})