Unit tests for webtoolkit.base64.js
This commit is contained in:
18
Netdisco/t/11-webtoolkit.base64.t
Normal file
18
Netdisco/t/11-webtoolkit.base64.t
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Test::More;
|
||||||
|
use Env::Path;
|
||||||
|
use FindBin qw( $Bin );
|
||||||
|
|
||||||
|
my @phantomjs = Env::Path->PATH->Whence('phantomjs');
|
||||||
|
my $phantomjs = scalar @phantomjs ? $phantomjs[0] : $ENV{ND_PHANTOMJS};
|
||||||
|
|
||||||
|
if ( !-x $phantomjs ) {
|
||||||
|
plan skip_all =>
|
||||||
|
"phantomjs not found, please set ND_PHANTOMJS or install phantomjs to the default location";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
exec( $phantomjs, "$Bin/run_qunit.js", "$Bin/webtoolkit.base64.html" );
|
||||||
|
}
|
||||||
34
Netdisco/t/webtoolkit.base64.html
Normal file
34
Netdisco/t/webtoolkit.base64.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>webtoolkit.base64.js unit tests</title>
|
||||||
|
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.14.0.css" type="text/css">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="qunit"></div>
|
||||||
|
<div id="qunit-fixture"></div>
|
||||||
|
<script src="http://code.jquery.com/qunit/qunit-1.14.0.js" type="text/javascript"></script>
|
||||||
|
<script src="qunit-tap.js" type="text/javascript"></script>
|
||||||
|
<script>
|
||||||
|
qunitTap(QUnit, function() { console.log.apply(console, arguments); });
|
||||||
|
</script>
|
||||||
|
<script src="../share/public/javascripts/webtoolkit.base64.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
QUnit.module("capitalizeFirstLetter");
|
||||||
|
QUnit.test("avaya like", function(assert) {
|
||||||
|
var lc = "1.10";
|
||||||
|
assert.deepEqual(Base64.encode(lc), "MS4xMA==");
|
||||||
|
});
|
||||||
|
QUnit.test("hex like", function(assert) {
|
||||||
|
var lc = "00:08:30:38:1a:10.1";
|
||||||
|
assert.deepEqual(Base64.encode(lc), "MDA6MDg6MzA6Mzg6MWE6MTAuMQ==");
|
||||||
|
});
|
||||||
|
QUnit.test("cisco like", function(assert) {
|
||||||
|
var lc = "GigabitEthernet1/0/6";
|
||||||
|
assert.deepEqual(Base64.encode(lc), "R2lnYWJpdEV0aGVybmV0MS8wLzY=");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user