BLUE
PHP 7.4.33
Path:
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/m3u8-parser/test
Run
Logout
Edit File
Size: 2.50 KB
Close
/var/www/sitesecurity.bitkit.dk/httpdocs/node_modules/m3u8-parser/test/line-stream.test.js
Text
Base64
import {LineStream} from '../src'; import QUnit from 'qunit'; QUnit.module('LineStream', { beforeEach() { this.lineStream = new LineStream(); } }); QUnit.test('empty inputs produce no tokens', function(assert) { let data = false; this.lineStream.on('data', function() { data = true; }); this.lineStream.push(''); assert.ok(!data, 'no tokens were produced'); }); QUnit.test('splits on newlines', function(assert) { const lines = []; this.lineStream.on('data', function(line) { lines.push(line); }); this.lineStream.push('#EXTM3U\nmovie.ts\n'); assert.strictEqual(2, lines.length, 'two lines are ready'); assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); }); QUnit.test('empty lines become empty strings', function(assert) { const lines = []; this.lineStream.on('data', function(line) { lines.push(line); }); this.lineStream.push('\n\n'); assert.strictEqual(2, lines.length, 'two lines are ready'); assert.strictEqual('', lines.shift(), 'the first line is empty'); assert.strictEqual('', lines.shift(), 'the second line is empty'); }); QUnit.test('handles lines broken across appends', function(assert) { const lines = []; this.lineStream.on('data', function(line) { lines.push(line); }); this.lineStream.push('#EXTM'); assert.strictEqual(0, lines.length, 'no lines are ready'); this.lineStream.push('3U\nmovie.ts\n'); assert.strictEqual(2, lines.length, 'two lines are ready'); assert.strictEqual('#EXTM3U', lines.shift(), 'the first line is the first token'); assert.strictEqual('movie.ts', lines.shift(), 'the second line is the second token'); }); QUnit.test('stops sending events after deregistering', function(assert) { const temporaryLines = []; const temporary = function(line) { temporaryLines.push(line); }; const permanentLines = []; const permanent = function(line) { permanentLines.push(line); }; this.lineStream.on('data', temporary); this.lineStream.on('data', permanent); this.lineStream.push('line one\n'); assert.strictEqual( temporaryLines.length, permanentLines.length, 'both callbacks receive the event' ); assert.ok(this.lineStream.off('data', temporary), 'a listener was removed'); this.lineStream.push('line two\n'); assert.strictEqual(1, temporaryLines.length, 'no new events are received'); assert.strictEqual(2, permanentLines.length, 'new events are still received'); });
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 3
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
fixtures
DIR
-
drwxr-xr-x
2026-04-28 09:11:39
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
line-stream.test.js
2.50 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
parse-stream.test.js
34.40 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
parser.test.js
45.21 KB
lrw-r--r--
2026-04-28 09:11:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).