-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#45 - add automated unit test to
gulp serve
task
- Loading branch information
1 parent
ffae99b
commit 3a436e2
Showing
4 changed files
with
100 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<!-- Test runner HTML file for executing tests with PhantomJS & displaying results --> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="UTF-8"> | ||
<title>TextChanger tests</title> | ||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css"/> | ||
</head> | ||
<body> | ||
<div id="mocha"></div> | ||
<script src="../node_modules/mocha/mocha.js"></script> | ||
<script>mocha.setup('bdd')</script> | ||
<script src="tests-browserify.js"></script> | ||
<script> | ||
if (window.mochaPhantomJS) { | ||
mochaPhantomJS.run(); | ||
} else { | ||
mocha.run(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var assert = require("assert"); | ||
|
||
/* use this method to test individual files instead of the whole prebid.js project */ | ||
|
||
//TODO refactor to use the spec files | ||
var utils = require('../src/utils'); | ||
|
||
describe('replaceTokenInString', function(){ | ||
|
||
it('should replace all given tokens in a String', function() { | ||
var tokensToReplace = { | ||
'foo': 'bar', | ||
'zap': 'quux' | ||
}; | ||
|
||
var output = utils.replaceTokenInString("hello %FOO%, I am %ZAP%", tokensToReplace, "%"); | ||
assert.equal(output, "hello bar, I am quux"); | ||
}); | ||
|
||
it('should ignore tokens it does not see', function() { | ||
var output = utils.replaceTokenInString("hello %FOO%", {}, "%"); | ||
|
||
assert.equal(output, "hello %FOO%"); | ||
}); | ||
}); |