xref: /third_party/node/test/parallel/test-stream-end-of-streams.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_cirequire('../common');
31cb0ef41Sopenharmony_ciconst assert = require('assert');
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ciconst { Duplex, finished } = require('stream');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciassert.throws(
81cb0ef41Sopenharmony_ci  () => {
91cb0ef41Sopenharmony_ci    // Passing empty object to mock invalid stream
101cb0ef41Sopenharmony_ci    // should throw error
111cb0ef41Sopenharmony_ci    finished({}, () => {});
121cb0ef41Sopenharmony_ci  },
131cb0ef41Sopenharmony_ci  { code: 'ERR_INVALID_ARG_TYPE' }
141cb0ef41Sopenharmony_ci);
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ciconst streamObj = new Duplex();
171cb0ef41Sopenharmony_cistreamObj.end();
181cb0ef41Sopenharmony_ci// Below code should not throw any errors as the
191cb0ef41Sopenharmony_ci// streamObj is `Stream`
201cb0ef41Sopenharmony_cifinished(streamObj, () => {});
21

Indexes created Thu Nov 07 10:32:03 CST 2024