Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 39 lines (35 sloc) 1.271 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

# Test CSV - Copyright David Worms <open@adaltas.com> (BSD Licensed)

fs = require 'fs'
should = require 'should'
csv = require '..'

describe 'buffer', ->
    it 'Buffer smaller than in', ->
        csv()
        .fromPath("#{__dirname}/buffer/smaller.in",
            bufferSize: 1024
        )
        .toPath("#{__dirname}/buffer/smaller.tmp")
        .transform (data) ->
            data.should.be.a 'object'
            data
        .on('end', ->
            expect = fs.readFileSync("#{__dirname}/buffer/smaller.out").toString()
            result = fs.readFileSync("#{__dirname}/buffer/smaller.tmp").toString()
            result.should.eql expect
            fs.unlink "#{__dirname}/buffer/smaller.tmp"
        )
    it 'Buffer same as in', ->
        csv()
        .fromPath("#{__dirname}/buffer/same.in",
            bufferSize: 1024
        )
        .toPath("#{__dirname}/buffer/same.tmp")
        .transform (data) ->
            data.should.be.a 'object'
            data
        .on('end', ->
            expect = fs.readFileSync("#{__dirname}/buffer/same.out").toString()
            result = fs.readFileSync("#{__dirname}/buffer/same.tmp").toString()
            result.should.eql expect
            fs.unlink "#{__dirname}/buffer/same.tmp"
        )
Something went wrong with that request. Please try again.