/
eapostnova
/
2026-1--study--simulation-modeling
Обзор
Документация
Войти
/
eapostnova
/
2026-1--study--simulation-modeling
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
3
CI/CD
Аналитика
Безопасность
develop
node_modules/through/test/end.js
45 строк
707 B
Елизавета Постнова
chore(site): add changelog
06 мар 2026, 00:34
Верифицирован
06 мар 2026, 00:34
8cca814
Код
Авторство
О чём код?
var test = require('tape') var through = require('../') // must emit end before close. test('end before close', function (assert) { var ts = through() var ended = false, closed = false ts.on('end', function () { assert.ok(!closed) ended = true }) ts.on('close', function () { assert.ok(ended) closed = true }) ts.write(1) ts.write(2) ts.write(3) ts.end() assert.ok(ended) assert.ok(closed) assert.end() }) test('end only once', function (t) { var ts = through() var ended = false, closed = false ts.on('end', function () { t.equal(ended, false) ended = true }) ts.queue(null) ts.queue(null) ts.queue(null) ts.resume() t.end() })