Skip to content

Commit

Permalink
Updating test files
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac committed Oct 1, 2013
1 parent 3778f1e commit 7cd5e41
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -19,3 +19,4 @@ node_modules
temp
coverage
output
wtf
10 changes: 10 additions & 0 deletions test/.jshintrc
@@ -0,0 +1,10 @@
{
"predef" : [
"describe",
"it",
"before",
"beforeEach",
"after",
"afterEach"
]
}
36 changes: 36 additions & 0 deletions test/inliner.js
@@ -0,0 +1,36 @@
/*jshint node:true */

"use strict";

var assert = require("assert"),
path = require("path"),

inliner = require("../lib/inliner");

describe("JS Inliner", function() {
describe("Main Module", function() {
it("should something something something", function(done) {
var file = "./test/specimens/test.ejs",
root = path.dirname(file);

inliner(file, { root : root }, function(err, results) {
var js;

assert.ifError(err);

assert.equal(results.length, 1);
assert.equal(results[0].file, file);

js = results[0].data.toString("utf8");

assert(js.indexOf("src=\"wooga.js\"") === -1);
assert(js.indexOf("src=\"/booga/fooga.js\"") === -1);

assert(js.indexOf("<script >var wooga = \"I am wooga.js\";</script>") > -1);
assert(js.indexOf("<script >var fooga = \"I am /booga/fooga.js\";</script>") > -1);

done();
});
});
});
});
19 changes: 19 additions & 0 deletions test/specimens/biggun.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
8 changes: 6 additions & 2 deletions tests/specimens/test.ejs → test/specimens/test.ejs
@@ -1,10 +1,14 @@
<script src="nooga.js"></script>
<script src="//fooga.com/wooga.js"></script>
<script>var GW2 = {};</script>
<script src="wooga.js"></script>
<script src="/booga/fooga.js"></script>
<script src="nooga.js"></script>

<script>
var fooga = 1,
booga = 2;
console.log(fooga + booga);
</script>
</script>
<script src="/booga/fooga.js"></script>
<!-- <script src="biggun.js"></script> -->
File renamed without changes.

0 comments on commit 7cd5e41

Please sign in to comment.