Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
932 B

  1. var fs = require ('fs');
  2. var net = require('net');
  3. var join = require('path').join;
  4. var file = join(__dirname, 'fixtures','all_npm.json');
  5. var it = require('it-is');
  6. var JSONStream = require('../');
  7. var str = fs.readFileSync(file);
  8. var datas = {}
  9. var server = net.createServer(function(client) {
  10. var data_calls = 0;
  11. var parser = JSONStream.parse(['rows', true, 'key']);
  12. parser.on('data', function(data) {
  13. ++ data_calls;
  14. datas[data] = (datas[data] || 0) + 1
  15. it(data).typeof('string')
  16. });
  17. parser.on('end', function() {
  18. console.log('END')
  19. var min = Infinity
  20. for (var d in datas)
  21. min = min > datas[d] ? datas[d] : min
  22. it(min).equal(3);
  23. server.close();
  24. });
  25. client.pipe(parser);
  26. });
  27. server.listen(9999);
  28. var client = net.connect({ port : 9999 }, function() {
  29. var msgs = str + ' ' + str + '\n\n' + str
  30. client.end(msgs);
  31. });