Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
516 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var test = require('tape')
|
---|
| 2 | var through = require('../')
|
---|
| 3 |
|
---|
| 4 | // must emit end before close.
|
---|
| 5 |
|
---|
| 6 | test('end before close', function (assert) {
|
---|
| 7 | var ts = through()
|
---|
| 8 | ts.autoDestroy = false
|
---|
| 9 | var ended = false, closed = false
|
---|
| 10 |
|
---|
| 11 | ts.on('end', function () {
|
---|
| 12 | assert.ok(!closed)
|
---|
| 13 | ended = true
|
---|
| 14 | })
|
---|
| 15 | ts.on('close', function () {
|
---|
| 16 | assert.ok(ended)
|
---|
| 17 | closed = true
|
---|
| 18 | })
|
---|
| 19 |
|
---|
| 20 | ts.write(1)
|
---|
| 21 | ts.write(2)
|
---|
| 22 | ts.write(3)
|
---|
| 23 | ts.end()
|
---|
| 24 | assert.ok(ended)
|
---|
| 25 | assert.notOk(closed)
|
---|
| 26 | ts.destroy()
|
---|
| 27 | assert.ok(closed)
|
---|
| 28 | assert.end()
|
---|
| 29 | })
|
---|
| 30 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.