UNPKG

679 BJavaScriptView Raw
1var should = require("should");
2
3var fs = require("fs");
4var path = require("path");
5
6var runLoader = require("./fakeModuleSystem");
7var twigLoader = require("../");
8
9var fixtures = path.join(__dirname, "fixtures");
10
11describe("loader", function() {
12 it("should add require statement to the twig library", function(done) {
13 var template = path.join(fixtures, "loader", "template.html.twig");
14 runLoader(twigLoader, path.join(fixtures, "loader"), template, fs.readFileSync(template, "utf-8"), function(err, result) {
15 if(err) throw err;
16
17 result.should.have.type("string");
18
19 result.should.match(/require\(\"twig\"\)\.twig/);
20
21 done();
22 });
23 });
24});