Front end of the Slack clone application.

test.js 542B

123456789101112131415161718192021222324252627
  1. var tape = require('tape')
  2. var toBuffer = require('./')
  3. tape('buffer returns buffer', function (t) {
  4. t.same(toBuffer(Buffer('hi')), Buffer('hi'))
  5. t.end()
  6. })
  7. tape('string returns buffer', function (t) {
  8. t.same(toBuffer('hi'), Buffer('hi'))
  9. t.end()
  10. })
  11. tape('string + enc returns buffer', function (t) {
  12. t.same(toBuffer('6869', 'hex'), Buffer('hi'))
  13. t.end()
  14. })
  15. tape('other input throws', function (t) {
  16. try {
  17. toBuffer(42)
  18. } catch (err) {
  19. t.same(err.message, 'Input should be a buffer or a string')
  20. t.end()
  21. }
  22. })