Rename db:export to api:generate

This commit is contained in:
Aleksandr Statciuk 2023-04-28 17:07:32 +03:00
parent 69901b74d1
commit 47febd7b93
3 changed files with 2 additions and 2 deletions

View file

@ -1,28 +0,0 @@
const { execSync } = require('child_process')
const fs = require('fs-extra')
beforeEach(() => {
fs.emptyDirSync('tests/__data__/output')
fs.mkdirSync('tests/__data__/output/database')
fs.copyFileSync(
'tests/__data__/input/database/db_export.streams.db',
'tests/__data__/output/database/streams.db'
)
const stdout = execSync(
'DB_DIR=tests/__data__/output/database DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output/.api npm run db:export',
{ encoding: 'utf8' }
)
})
it('can create streams.json', () => {
expect(content(`output/.api/streams.json`)).toMatchObject(content(`expected/.api/streams.json`))
})
function content(filepath) {
return JSON.parse(
fs.readFileSync(`tests/__data__/${filepath}`, {
encoding: 'utf8'
})
)
}