From 0fdc7c3a55daceb54c034a51b30f06a932236965 Mon Sep 17 00:00:00 2001 From: Sergey Kandaurov Date: Thu, 25 Oct 2018 15:43:48 +0300 Subject: Tests: Node.js application tests. --- test/node/write_callback/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 test/node/write_callback/app.js (limited to 'test/node/write_callback') diff --git a/test/node/write_callback/app.js b/test/node/write_callback/app.js new file mode 100755 index 00000000..9d4bc1c5 --- /dev/null +++ b/test/node/write_callback/app.js @@ -0,0 +1,10 @@ +#!/usr/bin/env node + +require('unit-http').createServer(function (req, res) { + res.writeHead(200, {'Content-Type': 'text/plain'}); + var a = 'blah'; + res.write('hello', 'utf8', function() { + a = 'world'; + }); + res.end(a); +}).listen(7080); -- cgit From 2ef5011236b1088c2f8b460c2c13c07e9b727477 Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Tue, 4 Dec 2018 19:05:10 +0300 Subject: Tests: fixed test_node_application_write_callback. Fixed the write() callback order test. Also introduced a separate test to verify the callback call itself. --- test/node/write_callback/app.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test/node/write_callback') diff --git a/test/node/write_callback/app.js b/test/node/write_callback/app.js index 9d4bc1c5..3a9e51e8 100755 --- a/test/node/write_callback/app.js +++ b/test/node/write_callback/app.js @@ -1,10 +1,13 @@ #!/usr/bin/env node +var fs = require('fs'); + require('unit-http').createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); - var a = 'blah'; + var a = 'world'; res.write('hello', 'utf8', function() { - a = 'world'; + a = 'blah'; + fs.appendFile('callback', '', function() {}); }); res.end(a); }).listen(7080); -- cgit