-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1184 from dukeofsussex/include_tests
Some more tests and tweaks
- Loading branch information
Showing
8 changed files
with
384 additions
and
11 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
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,64 @@ | ||
//dependencies | ||
var should = require('should'); | ||
var Configuration = require('../../include/config.js'); | ||
var Lib = require('../../lib'); | ||
|
||
describe('AdminNavigation', function() { | ||
|
||
var pb = null; | ||
var ClientJs = null; | ||
before('Initialize the Environment with the default configuration', function() { | ||
this.timeout(10000); | ||
|
||
pb = new Lib(Configuration.getBaseConfig()); | ||
ClientJs = pb.ClientJs; | ||
}); | ||
|
||
describe('ClientJS.getAngularController', function() { | ||
|
||
it('should return a valid Angular controller', function() { | ||
var expectedResult = '<script type="text/javascript">\n' | ||
+ 'var pencilblueApp = angular.module("pencilblueApp", ["ngRoute"])' | ||
+ '.controller("PencilBlueController", function($scope, $sce) {});\n' | ||
+ 'pencilblueApp.config(["$compileProvider",function(e) {' | ||
+ 'e.aHrefSanitizationWhitelist(/^s*(https?|ftp|mailto|javascript):/)}]);\n</script>'; | ||
|
||
ClientJs.getAngularController({}, []).should.have.property('raw').which.equal(expectedResult); | ||
|
||
expectedResult = '<script type="text/javascript">\n' | ||
+ 'var pencilblueApp = angular.module("pencilblueApp", ["module"])' | ||
+ '.controller("PencilBlueController", function($scope, $sce) {});\n' | ||
+ 'pencilblueApp.config(["$compileProvider",function(e) {' | ||
+ 'e.aHrefSanitizationWhitelist(/^s*(https?|ftp|mailto|javascript):/)}]);\n</script>'; | ||
|
||
ClientJs.getAngularController({}, ['module']).should.have.property('raw').which.equal(expectedResult); | ||
}); | ||
}); | ||
|
||
describe('ClientJS.getAngularObjects', function() { | ||
|
||
it('should return a valid script tag containing the passed code', function() { | ||
var expectedResult = '$scope.foo = "bar";\n$scope.true = function(val){return true;};\n'; | ||
|
||
ClientJs.getAngularObjects({foo: 'bar', true: 'function(val){return true;}'}).should.equal(expectedResult); | ||
}); | ||
}); | ||
|
||
describe('ClientJS.includeJS', function() { | ||
|
||
it('should return a valid script tag containing the passed url as source', function() { | ||
var expectedResult = '<script type="text/javascript" src="public/js/script.js"></script>'; | ||
|
||
ClientJs.includeJS('public/js/script.js').should.have.property('raw').which.equal(expectedResult); | ||
}); | ||
}); | ||
|
||
describe('ClientJS.getJSTag', function() { | ||
|
||
it('should return a valid script tag containing the passed code', function() { | ||
var expectedResult = '<script type="text/javascript">\nalert(\'Hello World\')\n</script>'; | ||
|
||
ClientJs.getJSTag('alert(\'Hello World\')').should.have.property('raw').which.equal(expectedResult); | ||
}); | ||
}); | ||
}); |
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,43 @@ | ||
//dependencies | ||
var should = require('should'); | ||
var Configuration = require('../../include/config.js'); | ||
var Lib = require('../../lib'); | ||
|
||
describe('Content', function() { | ||
|
||
var pb = null; | ||
var ContentService = null; | ||
before('Initialize the Environment with the default configuration', function() { | ||
this.timeout(10000); | ||
|
||
pb = new Lib(Configuration.getBaseConfig()); | ||
ContentService = pb.ContentService; | ||
}); | ||
|
||
describe('ContentService.getDefaultSettings', function() { | ||
|
||
it('should return the correct default settings', function() { | ||
var settings = ContentService.getDefaultSettings(); | ||
|
||
settings.should.be.an.Object(); | ||
settings.should.deepEqual({ | ||
articles_per_page: 5, | ||
auto_break_articles: 0, | ||
read_more_text: 'Read more', | ||
display_timestamp: 1, | ||
date_format: 'M dd, YYYY', | ||
two_digit_date: 0, | ||
display_hours_minutes: 1, | ||
time_format: '12', | ||
two_digit_time: 0, | ||
display_bylines: 1, | ||
display_author_photo: 1, | ||
display_author_position: 1, | ||
allow_comments: 1, | ||
default_comments: 1, | ||
require_account: 0, | ||
require_verification: 0 | ||
}); | ||
}); | ||
}); | ||
}); |
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,38 @@ | ||
//dependencies | ||
var should = require('should'); | ||
var Configuration = require('../../include/config.js'); | ||
var Lib = require('../../lib'); | ||
|
||
describe('Email', function() { | ||
|
||
var pb = null; | ||
var EmailService = null; | ||
before('Initialize the Environment with the default configuration', function() { | ||
this.timeout(10000); | ||
|
||
pb = new Lib(Configuration.getBaseConfig()); | ||
EmailService = pb.EmailService; | ||
}); | ||
|
||
describe('EmailService.getDefaultSettings', function() { | ||
|
||
it('should return the correct default settings', function() { | ||
var settings = EmailService.getDefaultSettings(); | ||
|
||
settings.should.be.an.Object(); | ||
settings.should.deepEqual({ | ||
from_name: pb.config.siteName, | ||
from_address: 'no-reply@sample.com', | ||
verification_subject: pb.config.siteName+' Account Confirmation', | ||
verification_content: '', | ||
template: 'admin/elements/default_verification_email', | ||
service: 'Gmail', | ||
host: '', | ||
secure_connection: 1, | ||
port: 465, | ||
username: '', | ||
password: '' | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.