-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: validate webstream encoder/decoder inspector
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const { TextEncoderStream, TextDecoderStream } = require('stream/web'); | ||
const util = require('util'); | ||
const assert = require('assert'); | ||
|
||
const textEncoderStream = new TextEncoderStream(); | ||
assert.strictEqual( | ||
util.inspect(textEncoderStream), | ||
`TextEncoderStream { | ||
encoding: 'utf-8', | ||
readable: ReadableStream { locked: false, state: 'readable', supportsBYOB: false }, | ||
writable: WritableStream { locked: false, state: 'writable' } | ||
}` | ||
); | ||
assert.throws(() => textEncoderStream[util.inspect.custom].call(), { | ||
code: 'ERR_INVALID_THIS', | ||
}); | ||
|
||
const textDecoderStream = new TextDecoderStream(); | ||
assert.strictEqual( | ||
util.inspect(textDecoderStream), | ||
`TextDecoderStream { | ||
encoding: 'utf-8', | ||
fatal: false, | ||
ignoreBOM: false, | ||
readable: ReadableStream { locked: false, state: 'readable', supportsBYOB: false }, | ||
writable: WritableStream { locked: false, state: 'writable' } | ||
}` | ||
); | ||
assert.throws(() => textDecoderStream[util.inspect.custom].call(), { | ||
code: 'ERR_INVALID_THIS', | ||
}); |