Update tests

This commit is contained in:
freearhey 2025-04-22 23:17:48 +03:00
parent 6543464515
commit 2841068ca0
5 changed files with 20 additions and 29 deletions

View file

@ -1,3 +1,4 @@
import { pathToFileURL } from 'node:url'
import { execSync } from 'child_process'
import fs from 'fs-extra'
import os from 'os'
@ -19,16 +20,12 @@ describe('api:generate', () => {
const stdout = execSync(cmd, { encoding: 'utf8' })
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
expect(content('output/.api/streams.json')).toMatchObject(
content('expected/api_generate/.api/streams.json')
expect(content('tests/__data__/output/.api/streams.json')).toMatchObject(
content('tests/__data__/expected/api_generate/.api/streams.json')
)
})
})
function content(filepath: string) {
return JSON.parse(
fs.readFileSync(`tests/__data__/${filepath}`, {
encoding: 'utf8'
})
)
return JSON.parse(fs.readFileSync(pathToFileURL(filepath), { encoding: 'utf8' }))
}