overleaf/libraries/stream-utils/test/unit/WritableBufferTests.js
Eric Mc Sween 12e7471213 Merge pull request #12916 from overleaf/bg-move-stream-buffer-code-to-library
move stream-related code to separate  `@overleaf/stream-utils` library

GitOrigin-RevId: a79a873109b927b4fc0ae36f47d5c67e0df58041
2023-06-02 08:05:57 +00:00

20 lines
668 B
JavaScript

const { expect } = require('chai')
const { WritableBuffer } = require('../../index')
describe('WritableBuffer', function () {
it('should store all data written to it in a node Buffer', function () {
const bufferStream = new WritableBuffer()
bufferStream.write('hello')
bufferStream.write('world')
bufferStream.end()
expect(bufferStream.contents().toString()).to.equal('helloworld')
})
it('should return the size of the data written to it', function () {
const bufferStream = new WritableBuffer()
bufferStream.write('hello')
bufferStream.write('world')
bufferStream.end()
expect(bufferStream.size()).to.equal(10)
})
})