'use strict';
var render = require('../lib/renderer');
var should = require('chai')
  .should();

describe('Hexo-Renderer-Bourbon', function () {
  it('should process Sass files', function () {

    var ctx = {
      config: {
        bourbon: {
          indentedSyntax: true,
          outputStyle: 'nested',
          precision: 8,
          imagePath: 'images',
          sourceComments: false,
          omitSourceMapUrl: false,
          sourceMapEmbed: false,
          sourceMapContents: false
        }
      }
    };

    var nSass = render.bind(ctx);

    var sass = [
      '$font-stack: Helvetica, sans-serif',
      '$primary-color: #333',
      '',
      'body',
      '  font: 100% $font-stack',
      '  color: $primary-color'
    ].join('\n');

    var sassRes = [
      'body {',
      '  font: 100% Helvetica, sans-serif;',
      '  color: #333; }'
    ].join('\n') + ('\n');

    var sassCss = nSass({
      text: sass,
      path: './somepath/path.sass'
    });

    ctx = {};
    sassRes.should.equal(sassCss);
  });

  it('should create sourcemaps', function () {

    var ctx = {
      config: {
        bourbon: {
          indentedSyntax: true,
          outputStyle: 'nested',
          precision: 5,
          imagePath: './images',
          sourceComments: true,
          omitSourceMapUrl: true,
          sourceMapEmbed: true,
          sourceMapContents: true,
          sourceMapRoot: './'
        }
      }
    };

    var nSass = render.bind(ctx);

    var sass = [
      '$font-stack: Helvetica, sans-serif',
      '$primary-color: #333',
      '',
      'body',
      '  font: 100% $font-stack',
      '  color: $primary-color'
    ].join('\n');

    var sassRes = [
      '/* line 4, D:/Repos/hexo-renderer-bourbon/path.sass */',
      'body {',
      '  font: 100% Helvetica, sans-serif;',
      '  color: #333; }'
    ].join('\n') + ('\n');

    var sassCss = nSass({
      text: sass,
      path: './path.sass'
    });

    ctx = {};
    sassRes.should.equal(sassCss);
  });
});

@@ -1244,17 +1244,16 @@
 ePath: '
-.
 /images'
@@ -1268,28 +1268,29 @@
     
-s
 ou
-rceComments: true
+tFile: './test.css'
 ,%0A  
@@ -1293,37 +1293,33 @@
 ,%0A          
-omitS
+s
 ourceMap
 Url: true,%0A 
@@ -1306,19 +1306,16 @@
 ourceMap
-Url
 : true,%0A
@@ -1350,43 +1350,8 @@
 ue,%0A
-          sourceMapContents: true,%0A
     
@@ -1372,17 +1372,16 @@
 pRoot: '
-.
 /'%0A     
@@ -1660,72 +1660,8 @@
 = %5B%0A
-      '/* line 4, D:/Repos/hexo-renderer-bourbon/path.sass */',%0A
     
@@ -1741,36 +1741,396 @@
 #333; %7D'
+,
 %0A    
-%5D.join('%5Cn') + 
+  '',%0A      '/*# sourceMappingURL=data:application/json;base64,ewoJInZlcnNpb24iOiAzLAoJInNvdXJjZVJvb3QiOiAiLyIsCgkiZmlsZSI6ICJ0ZXN0LmNzcyIsCgkic291cmNlcyI6IFsKCQkic3RkaW4iCgldLAoJInNvdXJjZXNDb250ZW50IjogW10sCgkibWFwcGluZ3MiOiAiQUFHQSxJQUFJLENBQUM7RUFDSCxJQUFJLEVBQUUsSUFBSSxDQUpDLFNBQVMsRUFBRSxVQUFVO0VBS2hDLEtBQUssRUFKUyxJQUFJLEdBRWQiLAoJIm5hbWVzIjogW10KfQ== */'%0A    %5D.join
 ('%5Cn');%0A
@@ -2176,35 +2176,8 @@
 sass
-,%0A      path: './path.sass'
 %0A   

fix tests