Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

test.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. var tape = require('tape')
  2. var through = require('through2')
  3. var stream = require('stream')
  4. var shift = require('./')
  5. tape('shifts next', function (t) {
  6. var passthrough = through()
  7. passthrough.write('hello')
  8. passthrough.write('world')
  9. t.same(shift(passthrough), Buffer('hello'))
  10. t.same(shift(passthrough), Buffer('world'))
  11. t.end()
  12. })
  13. tape('shifts next with core', function (t) {
  14. var passthrough = stream.PassThrough()
  15. passthrough.write('hello')
  16. passthrough.write('world')
  17. t.same(shift(passthrough), Buffer('hello'))
  18. t.same(shift(passthrough), Buffer('world'))
  19. t.end()
  20. })
  21. tape('shifts next with object mode', function (t) {
  22. var passthrough = through({objectMode: true})
  23. passthrough.write({hello: 1})
  24. passthrough.write({world: 1})
  25. t.same(shift(passthrough), {hello: 1})
  26. t.same(shift(passthrough), {world: 1})
  27. t.end()
  28. })
  29. tape('shifts next with object mode with core', function (t) {
  30. var passthrough = stream.PassThrough({objectMode: true})
  31. passthrough.write({hello: 1})
  32. passthrough.write({world: 1})
  33. t.same(shift(passthrough), {hello: 1})
  34. t.same(shift(passthrough), {world: 1})
  35. t.end()
  36. })