<commit_before>/**
 * Test dependencies.
 */

const test = require('tape')
const server = require('server-test')
const salute = require('..')
const concat = require('concat-stream')
const fs = require('fs')

test('should transfer string', assert => {
  assert.plan(1)
  server((req, res) => {
    salute(() => {
      return 'hello world'
    })(req, res).pipe(concat(data => assert.equal(data.toString(), 'hello world')))
  })
})

test('should transfer promise', assert => {
  assert.plan(1)
  server((req, res) => {
    salute(() => {
      return new Promise((resolve, reject) => {
        resolve('hello world')
      })
    })(req, res).pipe(concat(data => assert.equal(data.toString(), 'hello world')))
  })
})

test('should transfer stream', assert => {
  assert.plan(1)
  server((req, res) => {
    salute(() => {
      return fs.createReadStream(__dirname + '/salute.txt')
    })(req, res).pipe(concat(data => assert.equal(data.toString(), 'hello world')))
  })
})
<commit_msg>Transfer stream<commit_after>/**
 * Test dependencies.
 */

const test = require('tape')
const server = require('server-test')
const salute = require('..')
const concat = require('concat-stream')
const fs = require('fs')

test('should transfer string', assert => {
  assert.plan(1)
  server((req, res) => {
    salute(() => {
      return 'hello world'
    })(req, res).pipe(concat(data => assert.equal(data.toString(), 'hello world')))
  })
})

test('should transfer promise', assert => {
  assert.plan(1)
  server((req, res) => {
    salute(() => {
      return new Promise((resolve, reject) => {
        resolve('hello world')
      })
    })(req, res).pipe(concat(data => assert.equal(data.toString(), 'hello world')))
  })
})

test('should transfer stream', assert => {
  assert.plan(1)
  server((req, res) => {
    salute(() => {
      return fs.createReadStream(__dirname + '/salute.txt')
    })(req, res).pipe(concat(data => assert.equal(data.toString(), 'hello world\n')))
  })
})

{'fraction_non_alphanumeric': 0.2090080971659919, 'fraction_numerical': 0.003036437246963563, 'mean_word_length': 3.695961995249406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6223543', 'n_tokens_mistral': 634, 'n_tokens_neox': 627, 'n_words': 139}