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.

39 lines
785 B

  1. var fs = require ('fs')
  2. , join = require('path').join
  3. , file = join(__dirname, 'fixtures','all_npm.json')
  4. , JSONStream = require('../')
  5. , it = require('it-is')
  6. function fn (s) {
  7. return !isNaN(parseInt(s, 10))
  8. }
  9. var expected = JSON.parse(fs.readFileSync(file))
  10. , parser = JSONStream.parse(['rows', fn])
  11. , called = 0
  12. , ended = false
  13. , parsed = []
  14. fs.createReadStream(file).pipe(parser)
  15. parser.on('data', function (data) {
  16. called ++
  17. it.has({
  18. id: it.typeof('string'),
  19. value: {rev: it.typeof('string')},
  20. key:it.typeof('string')
  21. })
  22. parsed.push(data)
  23. })
  24. parser.on('end', function () {
  25. ended = true
  26. })
  27. process.on('exit', function () {
  28. it(called).equal(expected.rows.length)
  29. it(parsed).deepEqual(expected.rows)
  30. console.error('PASSED')
  31. })