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.

45 lines
707 B

  1. var test = require('tape')
  2. var through = require('../')
  3. // must emit end before close.
  4. test('end before close', function (assert) {
  5. var ts = through()
  6. var ended = false, closed = false
  7. ts.on('end', function () {
  8. assert.ok(!closed)
  9. ended = true
  10. })
  11. ts.on('close', function () {
  12. assert.ok(ended)
  13. closed = true
  14. })
  15. ts.write(1)
  16. ts.write(2)
  17. ts.write(3)
  18. ts.end()
  19. assert.ok(ended)
  20. assert.ok(closed)
  21. assert.end()
  22. })
  23. test('end only once', function (t) {
  24. var ts = through()
  25. var ended = false, closed = false
  26. ts.on('end', function () {
  27. t.equal(ended, false)
  28. ended = true
  29. })
  30. ts.queue(null)
  31. ts.queue(null)
  32. ts.queue(null)
  33. ts.resume()
  34. t.end()
  35. })