var assert = require('assert');
var { rollup } = require('rollup');
var string = require('../');

process.chdir('test');

function makeBundle(entry, options) {
	return rollup({
		entry,
		plugins: [string(options)]
	});
}

describe('rollup-plugin-string', () => {
	it('should stringify importing template', () => {
		return makeBundle('fixtures/basic.js', {
			include: '**/*.html'
		}).then(bundle => {
			const { code } = bundle.generate({
				format: 'iife',
				moduleName: 'tpl'
			});
			new Function('assert', code)(assert);
		});
	});

	it('throws when include is not specified', () => {
		assert.throws(() => {
			makeBundle('fixtures/basic.js')
		}, /include option should be specified/);
	});
});

@@ -139,62 +139,52 @@
 dle(
-entry, options) %7B%0A%09return rollup(%7B%0A%09%09entry,%0A%09%09
+options, stringOptions) %7B%0A%09options.
 plugins
-:
+ =
  %5Bst
@@ -192,17 +192,23 @@
 ing(
-o
+stringO
 ptions)%5D
 %0A%09%7D)
@@ -203,19 +203,40 @@
 ptions)%5D
+;
 %0A%09
-%7D
+return rollup(options
 );%0A%7D%0A%0Ade
@@ -337,32 +337,41 @@
 turn makeBundle(
+%7B entry: 
 'fixtures/basic.
@@ -377,15 +377,14 @@
 .js'
+ %7D
 , %7B
-%0A%09%09%09
+ 
 incl
@@ -399,19 +399,17 @@
 /*.html'
-%0A%09%09
+ 
 %7D).then(
@@ -457,21 +457,17 @@
 nerate(%7B
-%0A%09%09%09%09
+ 
 format: 
@@ -477,13 +477,9 @@
 fe',
-%0A%09%09%09%09
+ 
 modu
@@ -491,20 +491,17 @@
 e: 'tpl'
-%0A%09%09%09
+ 
 %7D);%0A%09%09%09n
@@ -549,16 +549,270 @@
 ;%0A%09%7D);%0A%0A
+%09it('should output empty sourcemap', () =%3E %7B%0A%09%09return makeBundle(%7B entry: 'fixtures/basic.js' %7D, %7B include: '**/*.html' %7D).then(bundle =%3E %7B%0A%09%09%09const %7B code, map %7D = bundle.generate(%7B sourceMap: true %7D);%0A%09%09%09assert.ok(code);%0A%09%09%09assert.ok(map);%0A%09%09%7D);%0A%09%7D);%0A%0A
 %09it('thr
@@ -893,16 +893,25 @@
 eBundle(
+%7B entry: 
 'fixture
@@ -921,17 +921,20 @@
 asic.js'
-)
+ %7D);
 %0A%09%09%7D, /i

Add test with sourcemaps