Move scripts to subfolders

This commit is contained in:
Aleksandr Statciuk 2022-02-26 23:21:44 +03:00
parent f0c64a55e4
commit b1a0bcf4b9
36 changed files with 204 additions and 222 deletions

View file

@ -0,0 +1,26 @@
const { execSync } = require('child_process')
const fs = require('fs-extra')
const path = require('path')
beforeEach(() => {
fs.emptyDirSync('tests/__data__/output')
const stdout = execSync(
'CHANNELS_PATH=tests/__data__/input/sites/**.channels.xml OUTPUT_DIR=tests/__data__/output/api npm run api:update',
{ encoding: 'utf8' }
)
})
it('can generate guides.json', () => {
expect(content('tests/__data__/output/api/guides.json')).toBe(
content('tests/__data__/expected/api/guides.json')
)
})
function content(filepath) {
const data = fs.readFileSync(path.resolve(filepath), {
encoding: 'utf8'
})
return JSON.stringify(data)
}