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.

35 lines
748 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. var expected = JSON.parse(fs.readFileSync(file))
  7. , parser = JSONStream.parse(['rows', /\d+/ /*, 'value'*/])
  8. , called = 0
  9. , ended = false
  10. , parsed = []
  11. fs.createReadStream(file).pipe(parser)
  12. parser.on('data', function (data) {
  13. called ++
  14. it.has({
  15. id: it.typeof('string'),
  16. value: {rev: it.typeof('string')},
  17. key:it.typeof('string')
  18. })
  19. parsed.push(data)
  20. })
  21. parser.on('end', function () {
  22. ended = true
  23. })
  24. process.on('exit', function () {
  25. it(called).equal(expected.rows.length)
  26. it(parsed).deepEqual(expected.rows)
  27. console.error('PASSED')
  28. })