WritableBufferTests.js 668 B

1234567891011121314151617181920
  1. const { expect } = require('chai')
  2. const { WritableBuffer } = require('../../index')
  3. describe('WritableBuffer', function () {
  4. it('should store all data written to it in a node Buffer', function () {
  5. const bufferStream = new WritableBuffer()
  6. bufferStream.write('hello')
  7. bufferStream.write('world')
  8. bufferStream.end()
  9. expect(bufferStream.contents().toString()).to.equal('helloworld')
  10. })
  11. it('should return the size of the data written to it', function () {
  12. const bufferStream = new WritableBuffer()
  13. bufferStream.write('hello')
  14. bufferStream.write('world')
  15. bufferStream.end()
  16. expect(bufferStream.size()).to.equal(10)
  17. })
  18. })