Update grab.test.ts

This commit is contained in:
freearhey
2025-10-29 07:56:55 +03:00
parent 4291cdd32f
commit 5845b24778

View File

@@ -99,16 +99,24 @@ describe('epg:grab', () => {
content('tests/__data__/expected/epg_grab/gzip.guide.xml') content('tests/__data__/expected/epg_grab/gzip.guide.xml')
) )
const expected = pako.ungzip(fs.readFileSync('tests/__data__/output/guides/gzip.guide.xml.gz')) const outputString = pako.ungzip(
const result = pako.ungzip( fs.readFileSync('tests/__data__/output/guides/gzip.guide.xml.gz'),
fs.readFileSync('tests/__data__/expected/epg_grab/gzip.guide.xml.gz') { to: 'string' }
) )
expect(expected).toEqual(result) const expectedString = pako.ungzip(
fs.readFileSync('tests/__data__/expected/epg_grab/gzip.guide.xml.gz'),
{ to: 'string' }
)
const output = new Set(outputString.split('\r\n'))
const expected = new Set(expectedString.split('\r\n'))
expect(output).toEqual(expected)
}) })
}) })
function content(filepath: string) { function content(filepath: string) {
return fs.readFileSync(pathToFileURL(filepath), { const string = fs.readFileSync(pathToFileURL(filepath), 'utf8')
encoding: 'utf8'
}) return new Set(string.split('\r\n'))
} }