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.

40 lines
767 B

  1. var test = require('tape')
  2. var JSONStream = require('../')
  3. test('map function', function (t) {
  4. var actual = []
  5. stream = JSONStream.parse([true], function (e) { return e*10 })
  6. stream.on('data', function (v) { actual.push(v)})
  7. stream.on('end', function () {
  8. t.deepEqual(actual, [10,20,30,40,50,60])
  9. t.end()
  10. })
  11. stream.write(JSON.stringify([1,2,3,4,5,6], null, 2))
  12. stream.end()
  13. })
  14. test('filter function', function (t) {
  15. var actual = []
  16. stream = JSONStream
  17. .parse([true], function (e) { return e%2 ? e : null})
  18. .on('data', function (v) { actual.push(v)})
  19. .on('end', function () {
  20. t.deepEqual(actual, [1,3,5])
  21. t.end()
  22. })
  23. stream.write(JSON.stringify([1,2,3,4,5,6], null, 2))
  24. stream.end()
  25. })