Update database/update.js

This commit is contained in:
Aleksandr Statciuk
2022-02-14 03:17:29 +03:00
parent 3350e7a2cb
commit a3e6764c00
3 changed files with 70 additions and 63 deletions

View File

@@ -4,3 +4,4 @@
{"title":"Kayhan TV","channel":"KayhanTV.af","filepath":"channels/af.m3u","url":"http://208.93.117.113/live/Stream1/playlist.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"cFFpFVzSn6xFMUF3"}
{"title":"Sharq","channel":"Sharq.af","filepath":"channels/af.m3u","url":"http://51.210.199.50/hls/stream.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"u7iyA6cjtf1iWWAZ"}
{"title":"BBC News HD","channel":"BBCNewsHD.ad","filepath":"tests/__data__/output/channels/uk.m3u","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http_referrer":null,"user_agent":null,"cluster_id":3,"_id":"WTbieV1ptnZVCIdn"}
{"title":"ABC","channel":"ABC.uk","filepath":"tests/__data__/output/channels/uk.m3u","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http_referrer":null,"user_agent":null,"cluster_id":3,"_id":"WTbieV1ptnZVCI3n"}

View File

@@ -8,14 +8,29 @@ beforeEach(() => {
'tests/__data__/input/database/db_update.streams.db',
'tests/__data__/output/streams.db'
)
})
it('can save results', () => {
const stdout = execSync(
'DB_DIR=tests/__data__/output LOGS_DIR=tests/__data__/input/logs/cluster/load npm run db:update',
{ encoding: 'utf8' }
)
})
expect(stdout).toEqual(`
> db:update
> node scripts/commands/database/update.js
loading streams...
found 7 streams
loading check results...
found 6 results
loading origins...
found 2 origins
updating streams...
updated 6 streams
removed 1 duplicates
done
`)
it('can save results', () => {
expect(content('tests/__data__/output/streams.db')).toEqual(
content('tests/__data__/expected/database/db_update.streams.db')
)