From 9fe1e4a7a6781ce1eef01a31cba216a4bcd822a1 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 13 Feb 2022 01:40:45 +0300 Subject: [PATCH] Create export.test.js --- tests/commands/database/export.test.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/commands/database/export.test.js diff --git a/tests/commands/database/export.test.js b/tests/commands/database/export.test.js new file mode 100644 index 0000000000..a6ddb3285b --- /dev/null +++ b/tests/commands/database/export.test.js @@ -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' + }) +}