MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

test/parallel/test-stream-writable-write-error.js:30–80  ·  view source on GitHub ↗
(autoDestroy)

Source from the content-addressed store, hash-verified

28}
29
30function test(autoDestroy) {
31 {
32 const w = new Writable({
33 autoDestroy,
34 write() {}
35 });
36 w.end();
37 expectError(w, ['asd'], 'ERR_STREAM_WRITE_AFTER_END');
38 }
39
40 {
41 const w = new Writable({
42 autoDestroy,
43 write() {}
44 });
45 w.destroy();
46 }
47
48 {
49 const w = new Writable({
50 autoDestroy,
51 write() {}
52 });
53 expectError(w, [null], 'ERR_STREAM_NULL_VALUES', true);
54 }
55
56 {
57 const w = new Writable({
58 autoDestroy,
59 write() {}
60 });
61 expectError(w, [{}], 'ERR_INVALID_ARG_TYPE', true);
62 }
63
64 {
65 const w = new Writable({
66 autoDestroy,
67 write() {}
68 });
69 expectError(w, ['asd', 'buffer'], 'ERR_UNKNOWN_ENCODING', true);
70 }
71
72 {
73 const w = new Writable({
74 autoDestroy,
75 decodeStrings: false,
76 write() {}
77 });
78 expectError(w, ['asd', 'buffer'], 'ERR_UNKNOWN_ENCODING', true);
79 }
80}
81
82test(false);
83test(true);

Calls 3

expectErrorFunction · 0.85
endMethod · 0.45
destroyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…