Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

try_catch.asynct.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. var it = require('it-is').style('colour')
  2. , split = require('..')
  3. exports ['emit mapper exceptions as error events'] = function (test) {
  4. var s = split(JSON.parse)
  5. , caughtError = false
  6. , rows = []
  7. s.on('error', function (err) {
  8. caughtError = true
  9. })
  10. s.on('data', function (row) { rows.push(row) })
  11. s.write('{"a":1}\n{"')
  12. it(caughtError).equal(false)
  13. it(rows).deepEqual([ { a: 1 } ])
  14. s.write('b":2}\n{"c":}\n')
  15. it(caughtError).equal(true)
  16. it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
  17. s.end()
  18. test.done()
  19. }
  20. exports ['mapper error events on trailing chunks'] = function (test) {
  21. var s = split(JSON.parse)
  22. , caughtError = false
  23. , rows = []
  24. s.on('error', function (err) {
  25. caughtError = true
  26. })
  27. s.on('data', function (row) { rows.push(row) })
  28. s.write('{"a":1}\n{"')
  29. it(caughtError).equal(false)
  30. it(rows).deepEqual([ { a: 1 } ])
  31. s.write('b":2}\n{"c":}')
  32. it(caughtError).equal(false)
  33. it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
  34. s.end()
  35. it(caughtError).equal(true)
  36. it(rows).deepEqual([ { a: 1 }, { b: 2 } ])
  37. test.done()
  38. }