options.asynct.js 438 B

1234567891011121314151617181920212223
  1. var it = require('it-is').style('colour')
  2. , split = require('..')
  3. exports ['maximum buffer limit'] = function (test) {
  4. var s = split(JSON.parse, null, {
  5. maxLength: 2
  6. })
  7. , caughtError = false
  8. , rows = []
  9. s.on('error', function (err) {
  10. caughtError = true
  11. })
  12. s.on('data', function (row) { rows.push(row) })
  13. s.write('{"a":1}\n{"')
  14. s.write('{ "')
  15. it(caughtError).equal(true)
  16. s.end()
  17. test.done()
  18. }