diff --git a/tests/commands/create-matrix.test.js b/tests/commands/create-matrix.test.js index 34a6405e..8999c10e 100644 --- a/tests/commands/create-matrix.test.js +++ b/tests/commands/create-matrix.test.js @@ -5,11 +5,20 @@ const { execSync } = require('child_process') beforeEach(() => { fs.rmdirSync('tests/__data__/output', { recursive: true }) fs.mkdirSync('tests/__data__/output') + fs.mkdirSync('tests/__data__/temp/database', { recursive: true }) + fs.copyFileSync( + 'tests/__data__/input/database/channels.db', + 'tests/__data__/temp/database/channels.db' + ) +}) + +afterEach(() => { + fs.rmdirSync('tests/__data__/temp', { recursive: true }) }) it('can create valid matrix', () => { const result = execSync( - 'DB_DIR=tests/__data__/input/database node scripts/commands/create-matrix.js', + 'DB_DIR=tests/__data__/temp/database node scripts/commands/create-matrix.js', { encoding: 'utf8' } diff --git a/tests/commands/generate-guides.test.js b/tests/commands/generate-guides.test.js index d89c1899..51e68e75 100644 --- a/tests/commands/generate-guides.test.js +++ b/tests/commands/generate-guides.test.js @@ -5,13 +5,22 @@ const { execSync } = require('child_process') beforeEach(() => { fs.rmdirSync('tests/__data__/output', { recursive: true }) fs.mkdirSync('tests/__data__/output') + fs.mkdirSync('tests/__data__/temp/database', { recursive: true }) + fs.copyFileSync( + 'tests/__data__/input/database/channels.db', + 'tests/__data__/temp/database/channels.db' + ) execSync( - 'PUBLIC_DIR=tests/__data__/output DB_DIR=tests/__data__/input/database node scripts/commands/generate-guides.js', + 'DB_DIR=tests/__data__/temp/database PUBLIC_DIR=tests/__data__/output node scripts/commands/generate-guides.js', { encoding: 'utf8' } ) }) +afterEach(() => { + fs.rmdirSync('tests/__data__/temp', { recursive: true }) +}) + it('can generate channels.json', () => { const output = content('tests/__data__/output/api/channels.json') const expected = content('tests/__data__/expected/api/channels.json') diff --git a/tests/commands/load-cluster.test.js b/tests/commands/load-cluster.test.js index c1be4376..0d449663 100644 --- a/tests/commands/load-cluster.test.js +++ b/tests/commands/load-cluster.test.js @@ -5,13 +5,22 @@ const { execSync } = require('child_process') beforeEach(() => { fs.rmdirSync('tests/__data__/output', { recursive: true }) fs.mkdirSync('tests/__data__/output') + fs.mkdirSync('tests/__data__/temp/database', { recursive: true }) + fs.copyFileSync( + 'tests/__data__/input/database/channels.db', + 'tests/__data__/temp/database/channels.db' + ) execSync( - 'DB_DIR=tests/__data__/input/database LOGS_DIR=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1', + 'DB_DIR=tests/__data__/temp/database LOGS_DIR=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1', { encoding: 'utf8' } ) }) +afterEach(() => { + fs.rmdirSync('tests/__data__/temp', { recursive: true }) +}) + it('can load cluster', () => { const output = fs.readFileSync( path.resolve('tests/__data__/output/logs/load-cluster/cluster_1.log'),