From 291803c31f829fe0d32bb3207bc11def95a7408c Mon Sep 17 00:00:00 2001 From: Nevena Bojovic Date: Tue, 1 Mar 2022 20:05:50 +0100 Subject: Urađena test aplikacija. Povezan front i back. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Front/node_modules/through/test/end.js | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sandbox/testAppNevena/Front/node_modules/through/test/end.js (limited to 'sandbox/testAppNevena/Front/node_modules/through/test/end.js') diff --git a/sandbox/testAppNevena/Front/node_modules/through/test/end.js b/sandbox/testAppNevena/Front/node_modules/through/test/end.js new file mode 100644 index 00000000..fa113f58 --- /dev/null +++ b/sandbox/testAppNevena/Front/node_modules/through/test/end.js @@ -0,0 +1,45 @@ +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() +}) -- cgit v1.2.3