'use strict';

var test = require('tape')
  , js = require('../')
  , prefix = __dirname + '/fixtures/transforms/'

test('envify', function (t) {
  t.plan(2)

  js(prefix + 'envify-entry.js', function (err, src) {
    t.error(err, 'does not error')
    t.ok(src.toString().indexOf('node_modules" === \'foo\')') > -1, 'contains compiled vars')
  })
})

test('ejsify', function (t) {
  t.plan(2)

  js(prefix + 'ejsify-entry.js', function (err, src) {
    t.error(err, 'does not error')
    t.ok(src.toString().indexOf('buf.push(\'<h1>\', escape((1,  title )), \'</h1>\'); })();') > -1, 'contains a compiled template')
  })
})

test('hbsfy', function (t) {
  t.plan(3)

  js(prefix + 'hbsfy-entry.js', function (err, src) {
    t.error(err, 'does not error')
    t.ok(src.toString().indexOf('require("./handlebars/base");') > -1, 'adds handlebars')
    t.ok(src.toString().indexOf('return "<h1>"\n') > -1, 'compiles correctly')
  })
})

test('jadeify', function (t) {
  t.plan(2)

  js(prefix + 'jadeify-entry.js', function (err, src) {
    t.error(err, 'does not error')
    // this is more reliable than checking a whole fixture
    t.ok(
      src.toString().indexOf('buf.push("<h1>" + (jade.escape(null == (jade_interp = title) ? "" : jade_interp)) + "</h1>");}.call(this,"title" in locals_for_with?locals_for_with.title:typeof title!=="undefined"?title:undefined));;return buf.join("");') > -1
      , 'compiles correctly'
    )
  })
})

test('partialify', function (t) {
  t.plan(3)

  js(prefix + 'partialify-entry.js', function (err, src) {
    t.error(err, 'does not error')
    t.ok(src.toString().indexOf('module.exports = \'<div>I am a dep</div>\'') > -1, 'adds the dep')
    t.ok(src.toString().indexOf('require(\'./partialify-dep.html\')') > -1, 'calls the dep')
  })
})

test('partialify-custom', function (t) {
  t.plan(3)

  js({
    entry: prefix + 'partialify-entry-custom.js'
    , transforms: [
      [require('partialify'), {'alsoAllow': 'xml'}]
    ]
  }, function (err, src) {
    t.error(err, 'does not error')
    t.ok(src.toString().indexOf('module.exports = \'<div>I am a dep</div>\'') > -1, 'adds the dep')
    t.ok(src.toString().indexOf('require(\'./partialify-dep.xml\')') > -1, 'calls the dep')
  })
})

test('brfs', function (t) {
  t.plan(2)

  js(prefix + 'brfs-entry.js', function (err, src) {
    t.error(err, 'does not error')
    t.ok(src.toString().indexOf('var dep = "I am a dep"') > -1, 'compiles correctly')
  })
})

test('reactify', function (t){
  t.plan(3)

  js(prefix + 'reactify-entry.jsx', function (err, src){
    t.error(err)
    t.ok(
      src.toString().indexOf('React.createElement("div", null, "hi")') > -1
      , 'compiles jsx'
    )

    t.ok(
      src.toString().indexOf('render:function(){') > -1
      , 'compiles es6'
    )
  })
})

@@ -68,16 +68,53 @@
  , p
-refix = 
+ath = require('path')%0A  , prefix = path.join(
 __di
@@ -122,21 +122,19 @@
 name
- +
+,
  '
-/
 fixtures
 /tra
@@ -129,17 +129,20 @@
 fixtures
-/
+', '
 transfor
@@ -143,18 +143,18 @@
 ansforms
-/
 '
+)
 %0A%0Atest('
@@ -195,24 +195,33 @@
 )%0A%0A  js(
+path.join(
 prefix
- +
+,
  'envify
@@ -222,32 +222,33 @@
 envify-entry.js'
+)
 , function (err,
@@ -441,24 +441,33 @@
 )%0A%0A  js(
+path.join(
 prefix
- +
+,
  'ejsify
@@ -468,32 +468,33 @@
 ejsify-entry.js'
+)
 , function (err,
@@ -724,24 +724,33 @@
 )%0A%0A  js(
+path.join(
 prefix
- +
+,
  'hbsfy-
@@ -750,32 +750,33 @@
 'hbsfy-entry.js'
+)
 , function (err,
@@ -1045,24 +1045,33 @@
 )%0A%0A  js(
+path.join(
 prefix
- +
+,
  'jadeif
@@ -1073,32 +1073,33 @@
 adeify-entry.js'
+)
 , function (err,
@@ -1564,24 +1564,33 @@
 )%0A%0A  js(
+path.join(
 prefix
- +
+,
  'partia
@@ -1595,32 +1595,33 @@
 ialify-entry.js'
+)
 , function (err,
@@ -1937,24 +1937,33 @@
  entry: 
+path.join(
 prefix
- +
+,
  'partia
@@ -1983,16 +1983,17 @@
 stom.js'
+)
 %0A    , t
@@ -2372,24 +2372,33 @@
 )%0A%0A  js(
+path.join(
 prefix
- +
+,
  'brfs-e
@@ -2405,16 +2405,17 @@
 ntry.js'
+)
 , functi
@@ -2613,16 +2613,25 @@
  js(
+path.join(
 prefix
- +
+,
  're
@@ -2647,16 +2647,17 @@
 try.jsx'
+)
 , functi

Use path.join for cross-compatibility