/* global describe, it */
const { expect } = require('chai')
const Seven = require('../../src/main')

const mockDir = './test/_mock'
const tmpDir = './test/_tmp'

describe('Functional: Advanced usage', function () {
  it('should add $raw arguments', function () {
    const archive = `${tmpDir}/advanced-raw.7z`
    const sourceRaw = [
      `${mockDir}/DirExt/*.txt`,
      `${mockDir}/DirExt/*.md`
    ]
    const seven = Seven.add(archive, `${mockDir}/DirExt/*.nop`, {
      recursive: true,
      $raw: sourceRaw,
      $defer: true
    })
    expect(seven._args).to.deep.equal([
      'a',
      './test/_tmp/advanced-raw.7z',
      './test/_mock/DirExt/*.nop',
      '-r',
      '-y',
      '-bb3',
      './test/_mock/DirExt/*.txt',
      './test/_mock/DirExt/*.md'
    ])
  })

  it('should work with context boolean flags', function () {
    const archive = `${tmpDir}/advanced-raw.7z`
    const sevenUnix = Seven.add(archive, 'nop', {
      caseSensitive: false,
      $defer: true
    })
    expect(sevenUnix._args).to.includes('-ssc-')
    const sevenWindows = Seven.add(archive, 'nop', {
      caseSensitive: true,
      $defer: true
    })
    expect(sevenWindows._args).to.includes('-ssc')
  })
})

@@ -1202,12 +1202,534 @@
 c')%0A  %7D)
+%0A%0A  it('should be able to compress from stdin', function (done) %7B%0A    const source = %60$%7BmockDir%7D/DirImages/architectural-design-architecture-blueprint-239886.jpg%60%0A    const archive = %60$%7BtmpDir%7D/advanced-stdin.7z%60%0A    const stdin = require('fs').createReadStream(source)%0A    const seven = Seven.add(archive, '', %7B%0A      fromStdin: 'public-name.jpg',%0A    %7D)    %0A    stdin.pipe(seven._childProcess.stdin)%0A    seven.on('end', function () %7B%0A      expect(seven.info.get('Items to compress')).to.eql('1')%0A      done()%0A    %7D)%0A  %7D)
 %0A%7D)%0A

Add compress from stdin