mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-03-16 22:20:23 +00:00
Converted tests from QUnit to Mocha+Expect
This commit is contained in:
parent
354a3187bd
commit
cfcd18fd0c
15 changed files with 17033 additions and 4064 deletions
1247
ext/expect.js
Normal file
1247
ext/expect.js
Normal file
File diff suppressed because it is too large
Load diff
9266
ext/jquery-1.7.1.js
vendored
Normal file
9266
ext/jquery-1.7.1.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
205
ext/mocha.css
Normal file
205
ext/mocha.css
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
@charset "UTF-8";
|
||||
body {
|
||||
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
padding: 60px 50px;
|
||||
}
|
||||
|
||||
#mocha ul, #mocha li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#mocha ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
#mocha h1, #mocha h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#mocha h1 {
|
||||
margin-top: 15px;
|
||||
font-size: 1em;
|
||||
font-weight: 200;
|
||||
}
|
||||
|
||||
#mocha h1 a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#mocha h1 a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#mocha .suite .suite h1 {
|
||||
margin-top: 0;
|
||||
font-size: .8em;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha h2 {
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#mocha .suite {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
#mocha .test:hover h2::after {
|
||||
position: relative;
|
||||
top: 0;
|
||||
right: -10px;
|
||||
content: '(view source)';
|
||||
font-size: 12px;
|
||||
font-family: arial;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#mocha .test.pending:hover h2::after {
|
||||
content: '(pending)';
|
||||
font-family: arial;
|
||||
}
|
||||
|
||||
#mocha .test.pass.medium .duration {
|
||||
background: #C09853;
|
||||
}
|
||||
|
||||
#mocha .test.pass.slow .duration {
|
||||
background: #B94A48;
|
||||
}
|
||||
|
||||
#mocha .test.pass::before {
|
||||
content: '✓';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #00d6b2;
|
||||
}
|
||||
|
||||
#mocha .test.pass .duration {
|
||||
font-size: 9px;
|
||||
margin-left: 5px;
|
||||
padding: 2px 5px;
|
||||
color: white;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-ms-border-radius: 5px;
|
||||
-o-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#mocha .test.pass.fast .duration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#mocha .test.pending {
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.pending::before {
|
||||
content: '◦';
|
||||
color: #0b97c4;
|
||||
}
|
||||
|
||||
#mocha .test.fail {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test.fail pre {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#mocha .test.fail::before {
|
||||
content: '✖';
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
#mocha .test pre.error {
|
||||
color: #c00;
|
||||
max-height: 300px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
#mocha .test pre {
|
||||
display: inline-block;
|
||||
font: 12px/1.5 monaco, monospace;
|
||||
margin: 5px;
|
||||
padding: 15px;
|
||||
border: 1px solid #eee;
|
||||
border-bottom-color: #ddd;
|
||||
-webkit-border-radius: 3px;
|
||||
-webkit-box-shadow: 0 1px 3px #eee;
|
||||
}
|
||||
|
||||
#report.pass .test.fail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#report.fail .test.pass {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#error {
|
||||
color: #c00;
|
||||
font-size: 1.5 em;
|
||||
font-weight: 100;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
#stats {
|
||||
position: fixed;
|
||||
top: 15px;
|
||||
right: 10px;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
#stats .progress {
|
||||
float: right;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#stats em {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#stats a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#stats a:hover {
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
#stats li {
|
||||
display: inline-block;
|
||||
margin: 0 5px;
|
||||
list-style: none;
|
||||
padding-top: 11px;
|
||||
}
|
||||
|
||||
code .comment { color: #ddd }
|
||||
code .init { color: #2F6FAD }
|
||||
code .string { color: #5890AD }
|
||||
code .keyword { color: #8A6343 }
|
||||
code .number { color: #2F6FAD }
|
||||
4911
ext/mocha.js
Normal file
4911
ext/mocha.js
Normal file
File diff suppressed because it is too large
Load diff
753
ext/pavlov.js
753
ext/pavlov.js
|
|
@ -1,753 +0,0 @@
|
|||
/**
|
||||
* Pavlov - Test framework-independent behavioral API
|
||||
*
|
||||
* version 0.3.0pre
|
||||
*
|
||||
* http://github.com/mmonteleone/pavlov
|
||||
*
|
||||
* Copyright (c) 2009-2011 Michael Monteleone
|
||||
* Licensed under terms of the MIT License (README.markdown)
|
||||
*/
|
||||
(function ( global ) {
|
||||
|
||||
// ===========
|
||||
// = Helpers =
|
||||
// ===========
|
||||
|
||||
var util = {
|
||||
/**
|
||||
* Iterates over an object or array
|
||||
* @param {Object|Array} object object or array to iterate
|
||||
* @param {Function} callback callback for each iterated item
|
||||
*/
|
||||
each : function ( object, callback ) {
|
||||
if ( typeof object === 'undefined' || typeof callback === 'undefined'
|
||||
|| object === null || callback === null ) {
|
||||
throw "both 'target' and 'callback' arguments are required";
|
||||
}
|
||||
var name,
|
||||
i = 0,
|
||||
length = object.length,
|
||||
value;
|
||||
|
||||
if ( length === undefined ) {
|
||||
for ( name in object ) {
|
||||
if ( object.hasOwnProperty( name ) ) {
|
||||
if ( callback.call( object[name], name, object[name] ) === false ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for ( value = object[0];
|
||||
i < length && callback.call( value, i, value ) !== false;
|
||||
value = object[++i] ) {
|
||||
}
|
||||
}
|
||||
|
||||
return object;
|
||||
},
|
||||
/**
|
||||
* converts an array-like object to an array
|
||||
* @param {Object} array array-like object
|
||||
* @returns array
|
||||
*/
|
||||
makeArray : function ( array ) {
|
||||
return Array.prototype.slice.call( array );
|
||||
},
|
||||
/**
|
||||
* returns whether or not an object is an array
|
||||
* @param {Object} obj object to test
|
||||
* @returns whether or not object is array
|
||||
*/
|
||||
isArray : function ( obj ) {
|
||||
return Object.prototype.toString.call( obj ) === "[object Array]";
|
||||
},
|
||||
/**
|
||||
* merges properties form one object to another
|
||||
* @param {Object} dest object to receive merged properties
|
||||
* @param {Object} src object containing properies to merge
|
||||
*/
|
||||
extend : function ( dest, src ) {
|
||||
if ( typeof dest === 'undefined' || typeof src === 'undefined' ||
|
||||
dest === null || src === null ) {
|
||||
throw "both 'source' and 'target' arguments are required";
|
||||
}
|
||||
var prop;
|
||||
for ( prop in src ) {
|
||||
if ( src.hasOwnProperty( prop ) ) {
|
||||
dest[prop] = src[prop];
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Naive display serializer for objects which wraps the objects'
|
||||
* own toString() value with type-specific delimiters.
|
||||
* [] for array
|
||||
* "" for string
|
||||
* Does not currently go nearly detailed enough for JSON use,
|
||||
* just enough to show small values within test results
|
||||
* @param {Object} obj object to serialize
|
||||
* @returns naive display-serialized string representation of the object
|
||||
*/
|
||||
serialize : function ( obj ) {
|
||||
if ( typeof obj === 'undefined' ) {
|
||||
return "";
|
||||
} else if ( Object.prototype.toString.call( obj ) === "[object Array]" ) {
|
||||
return '[' + obj.toString() + ']';
|
||||
} else if ( Object.prototype.toString.call( obj ) === "[object Function]" ) {
|
||||
return "function()";
|
||||
} else if ( typeof obj === "string" ) {
|
||||
return '"' + obj + '"';
|
||||
} else {
|
||||
return obj;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* transforms a camel or pascal case string
|
||||
* to all lower-case space-separated phrase
|
||||
* @param {string} value pascal or camel-cased string
|
||||
* @returns all-lower-case space-separated phrase
|
||||
*/
|
||||
phraseCase : function ( value ) {
|
||||
return value.replace( /([A-Z])/g, ' $1' ).toLowerCase();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// ====================
|
||||
// = Example Building =
|
||||
// ====================
|
||||
|
||||
var examples = [],
|
||||
currentExample,
|
||||
/**
|
||||
* Rolls up list of current and ancestors values for given prop name
|
||||
* @param {String} prop Name of property to roll up
|
||||
* @returns array of values corresponding to prop name
|
||||
*/
|
||||
rollup = function ( example, prop ) {
|
||||
var items = [];
|
||||
while ( example !== null ) {
|
||||
items.push( example[prop] );
|
||||
example = example.parent;
|
||||
}
|
||||
return items;
|
||||
};
|
||||
|
||||
/**
|
||||
* Example Class
|
||||
* Represents an instance of an example (a describe)
|
||||
* contains references to parent and nested examples
|
||||
* exposes methods for returning combined lists of before, after, and names
|
||||
* @constructor
|
||||
* @param {example} parent example to append self as child to (optional)
|
||||
*/
|
||||
function Example( parent ) {
|
||||
if ( parent ) {
|
||||
// if there's a parent, append self as nested example
|
||||
this.parent = parent;
|
||||
this.parent.children.push( this );
|
||||
} else {
|
||||
// otherwise, add this as a new root example
|
||||
examples.push( this );
|
||||
}
|
||||
|
||||
this.children = [];
|
||||
this.specs = [];
|
||||
}
|
||||
|
||||
util.extend( Example.prototype, {
|
||||
name : '', // name of this description
|
||||
parent : null, // parent example
|
||||
children : [], // nested examples
|
||||
specs : [], // array of it() tests/specs
|
||||
before : function () {
|
||||
}, // called before all contained specs
|
||||
after : function () {
|
||||
}, // called after all contained specs
|
||||
/**
|
||||
* rolls up this and ancestor's before functions
|
||||
* @returns array of functions
|
||||
*/
|
||||
befores : function () {
|
||||
return rollup( this, 'before' ).reverse();
|
||||
},
|
||||
/**
|
||||
* Rolls up this and ancestor's after functions
|
||||
* @returns array of functions
|
||||
*/
|
||||
afters : function () {
|
||||
return rollup( this, 'after' );
|
||||
},
|
||||
/**
|
||||
* Rolls up this and ancestor's description names, joined
|
||||
* @returns string of joined description names
|
||||
*/
|
||||
names : function () {
|
||||
return rollup( this, 'name' ).reverse().join( ', ' );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
// ==============
|
||||
// = Assertions =
|
||||
// ==============
|
||||
|
||||
/**
|
||||
* AssertionHandler
|
||||
* represents instance of an assertion regarding a particular
|
||||
* actual value, and provides an api around asserting that value
|
||||
* against any of the bundled assertion handlers and custom ones.
|
||||
* @constructor
|
||||
* @param {Object} value A test-produced value to assert against
|
||||
*/
|
||||
function AssertionHandler( value ) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends assertion methods to the AssertionHandler prototype
|
||||
* For each provided assertion implementation, adds an identically named
|
||||
* assertion function to assertionHandler prototype which can run implementation
|
||||
* @param {Object} asserts Object containing assertion implementations
|
||||
*/
|
||||
var addAssertions = function ( asserts ) {
|
||||
util.each( asserts, function ( name, fn ) {
|
||||
AssertionHandler.prototype[name] = function () {
|
||||
// implement this handler against backend
|
||||
// by pre-pending AssertionHandler's current value to args
|
||||
var args = util.makeArray( arguments );
|
||||
args.unshift( this.value );
|
||||
|
||||
// if no explicit message was given with the assertion,
|
||||
// then let's build our own friendly one
|
||||
if ( fn.length === 2 ) {
|
||||
args[1] = args[1] || 'asserting ' + util.serialize( args[0] ) + ' ' + util.phraseCase( name );
|
||||
} else if ( fn.length === 3 ) {
|
||||
var expected = util.serialize( args[1] );
|
||||
args[2] = args[2] || 'asserting ' + util.serialize( args[0] ) + ' ' + util.phraseCase( name ) + (expected ? ' ' + expected : expected);
|
||||
}
|
||||
|
||||
fn.apply( this, args );
|
||||
};
|
||||
} );
|
||||
};
|
||||
|
||||
/**
|
||||
* Add default assertions
|
||||
*/
|
||||
addAssertions( {
|
||||
equals : function ( actual, expected, message ) {
|
||||
adapter.assert( actual == expected, message );
|
||||
},
|
||||
isEqualTo : function ( actual, expected, message ) {
|
||||
adapter.assert( actual == expected, message );
|
||||
},
|
||||
isNotEqualTo : function ( actual, expected, message ) {
|
||||
adapter.assert( actual != expected, message );
|
||||
},
|
||||
isStrictlyEqualTo : function ( actual, expected, message ) {
|
||||
adapter.assert( actual === expected, message );
|
||||
},
|
||||
isNotStrictlyEqualTo : function ( actual, expected, message ) {
|
||||
adapter.assert( actual !== expected, message );
|
||||
},
|
||||
isTrue : function ( actual, message ) {
|
||||
adapter.assert( actual, message );
|
||||
},
|
||||
isFalse : function ( actual, message ) {
|
||||
adapter.assert( !actual, message );
|
||||
},
|
||||
isNull : function ( actual, message ) {
|
||||
adapter.assert( actual === null, message );
|
||||
},
|
||||
isNotNull : function ( actual, message ) {
|
||||
adapter.assert( actual !== null, message );
|
||||
},
|
||||
isDefined : function ( actual, message ) {
|
||||
adapter.assert( typeof actual !== 'undefined', message );
|
||||
},
|
||||
isUndefined : function ( actual, message ) {
|
||||
adapter.assert( typeof actual === 'undefined', message );
|
||||
},
|
||||
pass : function ( actual, message ) {
|
||||
adapter.assert( true, message );
|
||||
},
|
||||
fail : function ( actual, message ) {
|
||||
adapter.assert( false, message );
|
||||
},
|
||||
isFunction : function ( actual, message ) {
|
||||
return adapter.assert( typeof actual === "function", message );
|
||||
},
|
||||
isNotFunction : function ( actual, message ) {
|
||||
return adapter.assert( typeof actual !== "function", message );
|
||||
},
|
||||
throwsException : function ( actual, expectedErrorDescription, message ) {
|
||||
// can optionally accept expected error message
|
||||
try {
|
||||
actual();
|
||||
adapter.assert( false, message );
|
||||
} catch ( e ) {
|
||||
// so, this bit of weirdness is basically a way to allow for the fact
|
||||
// that the test may have specified a particular type of error to catch, or not.
|
||||
// and if not, e would always === e.
|
||||
adapter.assert( e === (expectedErrorDescription || e), message );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
// =====================
|
||||
// = pavlov Public API =
|
||||
// =====================
|
||||
|
||||
|
||||
/**
|
||||
* Object containing methods to be made available as public API
|
||||
*/
|
||||
var api = {
|
||||
/**
|
||||
* Initiates a new Example context
|
||||
* @param {String} description Name of what's being "described"
|
||||
* @param {Function} fn Function containing description (before, after, specs, nested examples)
|
||||
*/
|
||||
describe : function ( description, fn ) {
|
||||
if ( arguments.length < 2 ) {
|
||||
throw "both 'description' and 'fn' arguments are required";
|
||||
}
|
||||
|
||||
// capture reference to current example before construction
|
||||
var originalExample = currentExample;
|
||||
try {
|
||||
// create new current example for construction
|
||||
currentExample = new Example( currentExample );
|
||||
currentExample.name = description;
|
||||
fn();
|
||||
} finally {
|
||||
// restore original reference after construction
|
||||
currentExample = originalExample;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets a function to occur before all contained specs and nested examples' specs
|
||||
* @param {Function} fn Function to be executed
|
||||
*/
|
||||
before : function ( fn ) {
|
||||
if ( arguments.length === 0 ) {
|
||||
throw "'fn' argument is required";
|
||||
}
|
||||
currentExample.before = fn;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets a function to occur after all contained tests and nested examples' tests
|
||||
* @param {Function} fn Function to be executed
|
||||
*/
|
||||
after : function ( fn ) {
|
||||
if ( arguments.length === 0 ) {
|
||||
throw "'fn' argument is required";
|
||||
}
|
||||
currentExample.after = fn;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a spec (test) to occur within an example
|
||||
* When not passed fn, creates a spec-stubbing fn which asserts fail "Not Implemented"
|
||||
* @param {String} specification Description of what "it" "should do"
|
||||
* @param {Function} fn Function containing a test to assert that it does indeed do it (optional)
|
||||
*/
|
||||
it : function ( specification, fn ) {
|
||||
if ( arguments.length === 0 ) {
|
||||
throw "'specification' argument is required";
|
||||
}
|
||||
if ( fn ) {
|
||||
if ( fn.async ) {
|
||||
specification += " asynchronously";
|
||||
}
|
||||
currentExample.specs.push( [specification, fn] );
|
||||
} else {
|
||||
// if not passed an implementation, create an implementation that simply asserts fail
|
||||
api.it( specification, function () {
|
||||
api.assert.fail( 'Not Implemented' );
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* wraps a spec (test) implementation with an initial call to pause() the test runner
|
||||
* The spec must call resume() when ready
|
||||
* @param {Function} fn Function containing a test to assert that it does indeed do it (optional)
|
||||
*/
|
||||
async : function ( fn ) {
|
||||
var implementation = function () {
|
||||
adapter.pause();
|
||||
fn.apply( this, arguments );
|
||||
};
|
||||
implementation.async = true;
|
||||
return implementation;
|
||||
},
|
||||
|
||||
/**
|
||||
* Generates a row spec for each argument passed, applying
|
||||
* each argument to a new call against the spec
|
||||
* @returns an object with an it() function for defining
|
||||
* function to be called for each of given's arguments
|
||||
* @param {Array} arguments either list of values or list of arrays of values
|
||||
*/
|
||||
given : function () {
|
||||
if ( arguments.length === 0 ) {
|
||||
throw "at least one argument is required";
|
||||
}
|
||||
var args = util.makeArray( arguments );
|
||||
if ( arguments.length === 1 && util.isArray( arguments[0] ) ) {
|
||||
args = args[0];
|
||||
}
|
||||
|
||||
return {
|
||||
/**
|
||||
* Defines a row spec (test) which is applied against each
|
||||
* of the given's arguments.
|
||||
*/
|
||||
it : function ( specification, fn ) {
|
||||
util.each( args, function () {
|
||||
var arg = this;
|
||||
api.it( "given " + arg + ", " + specification, function () {
|
||||
fn.apply( this, util.isArray( arg ) ? arg : [arg] );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Assert a value against any of the bundled or custom assertions
|
||||
* @param {Object} value A value to be asserted
|
||||
* @returns an AssertionHandler instance to fluently perform an assertion with
|
||||
*/
|
||||
assert : function ( value ) {
|
||||
return new AssertionHandler( value );
|
||||
},
|
||||
|
||||
/**
|
||||
* specifies test runner to synchronously wait
|
||||
* @param {Number} ms Milliseconds to wait
|
||||
* @param {Function} fn Function to execute after ms has
|
||||
* passed before resuming
|
||||
*/
|
||||
wait : function ( ms, fn ) {
|
||||
if ( arguments.length < 2 ) {
|
||||
throw "both 'ms' and 'fn' arguments are required";
|
||||
}
|
||||
adapter.pause();
|
||||
global.setTimeout( function () {
|
||||
fn();
|
||||
adapter.resume();
|
||||
}, ms );
|
||||
},
|
||||
|
||||
/**
|
||||
* specifies test framework to pause test runner
|
||||
*/
|
||||
pause : function () {
|
||||
adapter.pause();
|
||||
},
|
||||
|
||||
/**
|
||||
* specifies test framework to resume test runner
|
||||
*/
|
||||
resume : function () {
|
||||
adapter.resume();
|
||||
}
|
||||
};
|
||||
|
||||
// extend api's assert function for easier access to
|
||||
// parameter-less assert.pass() and assert.fail() calls
|
||||
util.each( ['pass', 'fail'], function ( i, method ) {
|
||||
api.assert[method] = function ( message ) {
|
||||
api.assert()[method]( message );
|
||||
};
|
||||
} );
|
||||
|
||||
/**
|
||||
* Extends a function's scope
|
||||
* applies the extra scope to the function returns un-run new version of fn
|
||||
* inspired by Yehuda Katz's metaprogramming Screw.Unit
|
||||
* different in that new function can still accept all parameters original function could
|
||||
* @param {Function} fn Target function for extending
|
||||
* @param {Object} thisArg Object for the function's "this" to refer
|
||||
* @param {Object} extraScope object whose members will be added to fn's scope
|
||||
* @returns Modified version of original function with extra scope. Can still
|
||||
* accept parameters of original function
|
||||
*/
|
||||
var extendScope = function ( fn, thisArg, extraScope ) {
|
||||
|
||||
// get a string of the fn's parameters
|
||||
var params = fn.toString().match( /\(([^\)]*)\)/ )[1],
|
||||
// get a string of fn's body
|
||||
source = fn.toString().match( /^[^\{]*\{((.*\s*)*)\}/m )[1];
|
||||
|
||||
// create a new function with same parameters and
|
||||
// body wrapped in a with(extraScope) { }
|
||||
fn = new Function(
|
||||
"extraScope" + (params ? ", " + params : ""),
|
||||
"with(extraScope) {" + source + "}" );
|
||||
|
||||
// returns a fn wrapper which takes passed args,
|
||||
// pre-pends extraScope arg, and applies to modified fn
|
||||
return function () {
|
||||
var args = [extraScope];
|
||||
util.each( arguments, function () {
|
||||
args.push( this );
|
||||
} );
|
||||
fn.apply( thisArg, args );
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Top-level Specify method. Declares a new pavlov context
|
||||
* @param {String} name Name of what's being specified
|
||||
* @param {Function} fn Function containing exmaples and specs
|
||||
*/
|
||||
var specify = function ( name, fn ) {
|
||||
if ( arguments.length < 2 ) {
|
||||
throw "both 'name' and 'fn' arguments are required";
|
||||
}
|
||||
examples = [];
|
||||
currentExample = null;
|
||||
|
||||
// set the test suite title
|
||||
name += " Specifications";
|
||||
if ( typeof document !== 'undefined' ) {
|
||||
document.title = name + ' - Pavlov - ' + adapter.name;
|
||||
}
|
||||
|
||||
// run the adapter initiation
|
||||
adapter.initiate( name );
|
||||
|
||||
if ( specify.globalApi ) {
|
||||
// if set to extend global api,
|
||||
// extend global api and run example builder
|
||||
util.extend( global, api );
|
||||
fn();
|
||||
} else {
|
||||
// otherwise, extend example builder's scope with api
|
||||
// and run example builder
|
||||
extendScope( fn, this, api )();
|
||||
}
|
||||
|
||||
// compile examples against the adapter and then run them
|
||||
adapter.compile( name, examples )();
|
||||
};
|
||||
|
||||
// ====================================
|
||||
// = Test Framework Adapter Interface =
|
||||
// ====================================
|
||||
|
||||
// abstracts functionality of underlying testing framework
|
||||
var adapter = {
|
||||
/**
|
||||
* adapter-specific initialization code
|
||||
* which is called once before any tests are run
|
||||
* @param {String} suiteName name of the pavlov suite name
|
||||
*/
|
||||
initiate : function ( suiteName ) {
|
||||
},
|
||||
/**
|
||||
* adapter-specific assertion method
|
||||
* @param {bool} expr Boolean expression to assert against
|
||||
* @param {String} message message to pass along with assertion
|
||||
*/
|
||||
assert : function ( expr, message ) {
|
||||
throw "'assert' must be implemented by a test framework adapter";
|
||||
},
|
||||
/**
|
||||
* adapter-specific compilation method. Translates a nested set of
|
||||
* pre-constructed Pavlov example objects into a callable function which, when run
|
||||
* will execute the tests within the backend test framework
|
||||
* @param {String} suiteName name of overall test suite
|
||||
* @param {Array} examples Array of example object instances, possibly nesteds
|
||||
*/
|
||||
compile : function ( suiteName, examples ) {
|
||||
throw "'compile' must be implemented by a test framework adapter";
|
||||
},
|
||||
/**
|
||||
* adapter-specific pause method. When an adapter implements,
|
||||
* allows for its test runner to pause its execution
|
||||
*/
|
||||
pause : function () {
|
||||
throw "'pause' not implemented by current test framework adapter";
|
||||
},
|
||||
/**
|
||||
* adapter-specific resume method. When an adapter implements,
|
||||
* allows for its test runner to resume after a pause
|
||||
*/
|
||||
resume : function () {
|
||||
throw "'resume' not implemented by current test framework adapter";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// =====================
|
||||
// = Expose Public API =
|
||||
// =====================
|
||||
|
||||
// add global settings onto pavlov
|
||||
global.pavlov = {
|
||||
version : '0.3.0pre',
|
||||
specify : specify,
|
||||
adapter : adapter,
|
||||
adapt : function ( frameworkName, testFrameworkAdapter ) {
|
||||
if ( typeof frameworkName === "undefined" ||
|
||||
typeof testFrameworkAdapter === "undefined" ||
|
||||
frameworkName === null ||
|
||||
testFrameworkAdapter === null ) {
|
||||
throw "both 'frameworkName' and 'testFrameworkAdapter' arguments are required";
|
||||
}
|
||||
adapter.name = frameworkName;
|
||||
util.extend( adapter, testFrameworkAdapter );
|
||||
},
|
||||
util : {
|
||||
each : util.each,
|
||||
extend : util.extend
|
||||
},
|
||||
api : api,
|
||||
globalApi : false, // when true, adds api to global scope
|
||||
extendAssertions : addAssertions // function for adding custom assertions
|
||||
};
|
||||
}( window ));
|
||||
|
||||
|
||||
// =========================
|
||||
// = Default QUnit Adapter =
|
||||
// =========================
|
||||
|
||||
(function () {
|
||||
if ( typeof QUnit === 'undefined' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
pavlov.adapt( "QUnit", {
|
||||
initiate : function ( name ) {
|
||||
var addEvent = function ( elem, type, fn ) {
|
||||
if ( elem.addEventListener ) {
|
||||
elem.addEventListener( type, fn, false );
|
||||
} else if ( elem.attachEvent ) {
|
||||
elem.attachEvent( "on" + type, fn );
|
||||
}
|
||||
};
|
||||
|
||||
// after suite loads, set the header on the report page
|
||||
addEvent( window, 'load', function () {
|
||||
// document.getElementsByTag('h1').innerHTML = name;
|
||||
var h1s = document.getElementsByTagName( 'h1' );
|
||||
if ( h1s.length > 0 ) {
|
||||
h1s[0].innerHTML = name;
|
||||
}
|
||||
} );
|
||||
},
|
||||
/**
|
||||
* Implements assert against QUnit's `ok`
|
||||
*/
|
||||
assert : function ( expr, msg ) {
|
||||
ok( expr, msg );
|
||||
},
|
||||
/**
|
||||
* Implements pause against QUnit's stop()
|
||||
*/
|
||||
pause : function () {
|
||||
stop();
|
||||
},
|
||||
/**
|
||||
* Implements resume against QUnit's start()
|
||||
*/
|
||||
resume : function () {
|
||||
start();
|
||||
},
|
||||
/**
|
||||
* Compiles nested set of examples into flat array of QUnit statements
|
||||
* returned bound up in a single callable function
|
||||
* @param {Array} examples Array of possibly nested Example instances
|
||||
* @returns function of which, when called, will execute all translated QUnit statements
|
||||
*/
|
||||
compile : function ( name, examples ) {
|
||||
var statements = [],
|
||||
each = pavlov.util.each;
|
||||
|
||||
/**
|
||||
* Comples a single example and its children into QUnit statements
|
||||
* @param {Example} example Single example instance
|
||||
* possibly with nested instances
|
||||
*/
|
||||
var compileDescription = function ( example ) {
|
||||
|
||||
// get before and after rollups
|
||||
var befores = example.befores(),
|
||||
afters = example.afters();
|
||||
|
||||
// create a module with setup and teardown
|
||||
// that executes all current befores/afters
|
||||
statements.push( function () {
|
||||
module( example.names(), {
|
||||
setup : function () {
|
||||
each( befores, function () {
|
||||
this();
|
||||
} );
|
||||
},
|
||||
teardown : function () {
|
||||
each( afters, function () {
|
||||
this();
|
||||
} );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// create a test for each spec/"it" in the example
|
||||
each( example.specs, function () {
|
||||
var spec = this;
|
||||
statements.push( function () {
|
||||
test( spec[0], spec[1] );
|
||||
} );
|
||||
} );
|
||||
|
||||
// recurse through example's nested examples
|
||||
each( example.children, function () {
|
||||
compileDescription( this );
|
||||
} );
|
||||
};
|
||||
|
||||
// compile all root examples
|
||||
each( examples, function () {
|
||||
compileDescription( this, statements );
|
||||
} );
|
||||
|
||||
// return a single function which, when called,
|
||||
// executes all qunit statements
|
||||
return function () {
|
||||
each( statements, function () {
|
||||
this();
|
||||
} );
|
||||
};
|
||||
}
|
||||
} );
|
||||
|
||||
pavlov.extendAssertions( {
|
||||
/**
|
||||
* Asserts two objects are deeply equivalent, proxying QUnit's deepEqual assertion
|
||||
*/
|
||||
isSameAs : function ( actual, expected, message ) {
|
||||
deepEqual( actual, expected, message );
|
||||
},
|
||||
/*
|
||||
* Asserts two objects are deeply in-equivalent, proxying QUnit's notDeepEqual assertion
|
||||
*/
|
||||
isNotSameAs : function ( actual, expected, message ) {
|
||||
notDeepEqual( actual, expected, message );
|
||||
}
|
||||
} );
|
||||
|
||||
// alias pavlov.specify as QUnit.specify for legacy support
|
||||
QUnit.specify = pavlov.specify;
|
||||
pavlov.util.extend( QUnit.specify, pavlov );
|
||||
}());
|
||||
261
ext/qunit.css
261
ext/qunit.css
|
|
@ -1,261 +0,0 @@
|
|||
/**
|
||||
* QUnit v1.3.0pre - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://docs.jquery.com/QUnit
|
||||
*
|
||||
* Copyright (c) 2011 John Resig, Jörn Zaefferer
|
||||
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||
* or GPL (GPL-LICENSE.txt) licenses.
|
||||
* Pulled Live from Git Sat Feb 11 19:20:01 UTC 2012
|
||||
* Last Commit: 0712230bb203c262211649b32bd712ec7df5f857
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li {
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
#qunit-tests {
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699a4;
|
||||
background-color: #0d3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: normal;
|
||||
|
||||
border-radius: 15px 15px 0 0;
|
||||
-moz-border-radius: 15px 15px 0 0;
|
||||
-webkit-border-top-right-radius: 15px;
|
||||
-webkit-border-top-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #c2ccd1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 0 0.5em 2em;
|
||||
color: #5E740B;
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li a {
|
||||
padding: 0.5em;
|
||||
color: #c2ccd1;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests li a:hover,
|
||||
#qunit-tests li a:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#qunit-tests ol {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
-webkit-border-radius: 15px;
|
||||
|
||||
box-shadow: inset 0px 2px 13px #999;
|
||||
-moz-box-shadow: inset 0px 2px 13px #999;
|
||||
-webkit-box-shadow: inset 0px 2px 13px #999;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 .5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #e0f2be;
|
||||
color: #374e0c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #ffcaca;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#qunit-tests b.passed {
|
||||
color: #5E740B;
|
||||
}
|
||||
|
||||
#qunit-tests b.failed {
|
||||
color: #710909;
|
||||
}
|
||||
|
||||
#qunit-tests li li {
|
||||
margin: 0.5em;
|
||||
padding: 0.4em 0.5em 0.4em 0.5em;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #5E740B;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass {
|
||||
color: #528CE0;
|
||||
background-color: #D2E0E6;
|
||||
}
|
||||
|
||||
#qunit-tests .pass .test-name {
|
||||
color: #366097;
|
||||
}
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected {
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
#qunit-banner.qunit-pass {
|
||||
background-color: #C6E746;
|
||||
}
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 26px solid #EE5757;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#qunit-tests > li:last-child {
|
||||
border-radius: 0 0 15px 15px;
|
||||
-moz-border-radius: 0 0 15px 15px;
|
||||
-webkit-border-bottom-right-radius: 15px;
|
||||
-webkit-border-bottom-left-radius: 15px;
|
||||
}
|
||||
|
||||
#qunit-tests .fail {
|
||||
color: #000000;
|
||||
background-color: #EE5757;
|
||||
}
|
||||
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#qunit-tests .fail .test-actual {
|
||||
color: #EE5757;
|
||||
}
|
||||
|
||||
#qunit-tests .fail .test-expected {
|
||||
color: green;
|
||||
}
|
||||
|
||||
#qunit-banner.qunit-fail {
|
||||
background-color: #EE5757;
|
||||
}
|
||||
|
||||
/** Result */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
}
|
||||
1633
ext/qunit.js
1633
ext/qunit.js
File diff suppressed because it is too large
Load diff
|
|
@ -1,75 +1,74 @@
|
|||
QUnit.specify( "postal.js", function () {
|
||||
describe( "amqpBindingsResolver", function () {
|
||||
describe( "When calling compare", function () {
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.Middle.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.Middle.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["Top.Middle.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
|
||||
describe( "amqpBindingsResolver", function () {
|
||||
describe( "When calling compare", function () {
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.Middle.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.Middle.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["Top.Middle.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.#.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
describe( "With topic Top.Middle.SubMiddle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.#.Bottom", "Top.Middle.SubMiddle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.SubMiddle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.SubTop.Middle.SubMiddle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.#.Bottom", "Top.SubTop.Middle.SubMiddle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.SubTop.Middle.SubMiddle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.*.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["Top.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.#.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
describe( "With topic Top.Middle.SubMiddle.Bottom and binding Top.*.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.*.Bottom", "Top.Middle.SubMiddle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.SubMiddle.Bottom"]["Top.*.Bottom"];
|
||||
it( "Result should be false", function () {
|
||||
assert( result ).isFalse();
|
||||
} );
|
||||
it( "Should *not* create a resolver cache entry", function () {
|
||||
assert( cached ).isFalse();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding #.*.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "#.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["#.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.SubMiddle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.#.Bottom", "Top.Middle.SubMiddle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.SubMiddle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.SubTop.Middle.SubMiddle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.#.Bottom", "Top.SubTop.Middle.SubMiddle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.SubTop.Middle.SubMiddle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.*.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["Top.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.SubMiddle.Bottom and binding Top.*.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "Top.*.Bottom", "Top.Middle.SubMiddle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.SubMiddle.Bottom"]["Top.*.Bottom"];
|
||||
it( "Result should be false", function () {
|
||||
expect( result ).to.not.be.ok()
|
||||
} );
|
||||
it( "Should *not* create a resolver cache entry", function () {
|
||||
expect( cached ).to.not.be.ok()
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding #.*.Bottom", function () {
|
||||
var result = bindingsResolver.compare( "#.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = bindingsResolver.cache["Top.Middle.Bottom"]["#.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -1,45 +1,43 @@
|
|||
QUnit.specify( "postal.js", function () {
|
||||
describe( "bindingsResolver", function () {
|
||||
describe( "When calling compare", function () {
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.Middle.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "Top.Middle.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["Top.Middle.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
describe( "bindingsResolver", function () {
|
||||
describe( "When calling compare", function () {
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.Middle.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "Top.Middle.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["Top.Middle.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "Top.#.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.*.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "Top.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["Top.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.#.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "Top.#.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["Top.#.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding #.*.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "#.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["#.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
assert( result ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
assert( cached ).isTrue();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding Top.*.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "Top.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["Top.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "With topic Top.Middle.Bottom and binding #.*.Bottom", function () {
|
||||
var result = classicBindingsResolver.compare( "#.*.Bottom", "Top.Middle.Bottom" ),
|
||||
cached = classicBindingsResolver.cache["Top.Middle.Bottom"]["#.*.Bottom"];
|
||||
it( "Result should be true", function () {
|
||||
expect( result ).to.be.ok();
|
||||
} );
|
||||
it( "Should create a resolver cache entry", function () {
|
||||
expect( cached ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
|
|||
|
|
@ -1,31 +1,29 @@
|
|||
QUnit.specify( "postal.js", function () {
|
||||
describe( "ChannelDefinition", function () {
|
||||
describe( "When initializing a channel definition", function () {
|
||||
var chDef = new ChannelDefinition( "TestChannel", "TestTopic" );
|
||||
it( "should set channel to TestChannel", function () {
|
||||
assert( chDef.channel ).equals( "TestChannel" );
|
||||
} );
|
||||
it( "should set topic to TestTopic", function () {
|
||||
assert( chDef._topic ).equals( "TestTopic" );
|
||||
} );
|
||||
describe( "ChannelDefinition", function () {
|
||||
describe( "When initializing a channel definition", function () {
|
||||
var chDef = new ChannelDefinition( "TestChannel", "TestTopic" );
|
||||
it( "should set channel to TestChannel", function () {
|
||||
expect( chDef.channel ).to.be( "TestChannel" );
|
||||
} );
|
||||
describe( "When calling subscribe", function () {
|
||||
var ch = new ChannelDefinition( "TestChannel", "TestTopic" ),
|
||||
sub = ch.subscribe( function () {
|
||||
} );
|
||||
it( "subscription should be instance of SubscriptionDefinition", function () {
|
||||
assert( sub instanceof SubscriptionDefinition ).isTrue();
|
||||
} );
|
||||
it( "should set topic to TestTopic", function () {
|
||||
expect( chDef._topic ).to.be( "TestTopic" );
|
||||
} );
|
||||
describe( "When calling topic", function () {
|
||||
var ch = new ChannelDefinition( "TestChannel", "TestTopic" ),
|
||||
ch2 = ch.topic( "TestTopic2" );
|
||||
it( "new channel should be of type ChannelDefinition", function () {
|
||||
assert( ch2 instanceof ChannelDefinition ).isTrue();
|
||||
} );
|
||||
it( "new channel should have topic of TestTopic2", function () {
|
||||
assert( ch2._topic ).equals( "TestTopic2" );
|
||||
} );
|
||||
describe( "When calling subscribe", function () {
|
||||
var ch = new ChannelDefinition( "TestChannel", "TestTopic" ),
|
||||
sub = ch.subscribe( function () {
|
||||
} );
|
||||
it( "subscription should be instance of SubscriptionDefinition", function () {
|
||||
expect( sub instanceof SubscriptionDefinition ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "When calling topic", function () {
|
||||
var ch = new ChannelDefinition( "TestChannel", "TestTopic" ),
|
||||
ch2 = ch.topic( "TestTopic2" );
|
||||
it( "new channel should be of type ChannelDefinition", function () {
|
||||
expect( ch2 instanceof ChannelDefinition ).to.be.ok();
|
||||
} );
|
||||
it( "new channel should have topic of TestTopic2", function () {
|
||||
expect( ch2._topic ).to.be( "TestTopic2" );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
@ -1,76 +1,74 @@
|
|||
QUnit.specify( "postal.js", function () {
|
||||
describe( "ConsecutiveDistinctPredicate", function () {
|
||||
describe( "When calling the function with the same data multiple times", function () {
|
||||
var pred = new ConsecutiveDistinctPredicate(),
|
||||
data = { name : "Dr Who" },
|
||||
results = [];
|
||||
results.push( pred( data ) );
|
||||
results.push( pred( data ) );
|
||||
results.push( pred( data ) );
|
||||
describe( "ConsecutiveDistinctPredicate", function () {
|
||||
describe( "When calling the function with the same data multiple times", function () {
|
||||
var pred = new ConsecutiveDistinctPredicate(),
|
||||
data = { name : "Dr Who" },
|
||||
results = [];
|
||||
results.push( pred( data ) );
|
||||
results.push( pred( data ) );
|
||||
results.push( pred( data ) );
|
||||
|
||||
it( "The first result should be true", function () {
|
||||
assert( results[0] ).isTrue();
|
||||
} );
|
||||
it( "The second result should be false", function () {
|
||||
assert( results[1] ).isFalse();
|
||||
} );
|
||||
it( "The third result should be false", function () {
|
||||
assert( results[2] ).isFalse();
|
||||
} );
|
||||
it( "The first result should be true", function () {
|
||||
expect( results[0] ).to.be.ok();
|
||||
} );
|
||||
describe( "When calling the function with different data every time", function () {
|
||||
var predA = new ConsecutiveDistinctPredicate(),
|
||||
data = { name : "Amelia" },
|
||||
res = [];
|
||||
res.push( predA( data ) );
|
||||
data.name = "Rose";
|
||||
res.push( predA( data ) );
|
||||
data.name = "Martha";
|
||||
res.push( predA( data ) );
|
||||
|
||||
it( "The first result should be true", function () {
|
||||
assert( res[0] ).isTrue();
|
||||
} );
|
||||
it( "The second result should be true", function () {
|
||||
assert( res[1] ).isTrue();
|
||||
} );
|
||||
it( "The third result should be true", function () {
|
||||
assert( res[2] ).isTrue();
|
||||
} );
|
||||
it( "The second result should be false", function () {
|
||||
expect( results[1] ).to.not.be.ok()
|
||||
} );
|
||||
describe( "When calling the function with different data every two calls", function () {
|
||||
var predA = new ConsecutiveDistinctPredicate(),
|
||||
data = { name : "Amelia" },
|
||||
res = [];
|
||||
res.push( predA( data ) );
|
||||
res.push( predA( data ) );
|
||||
data.name = "Rose";
|
||||
res.push( predA( data ) );
|
||||
res.push( predA( data ) );
|
||||
data.name = "Martha";
|
||||
res.push( predA( data ) );
|
||||
res.push( predA( data ) );
|
||||
it( "The third result should be false", function () {
|
||||
expect( results[2] ).to.not.be.ok()
|
||||
} );
|
||||
} );
|
||||
describe( "When calling the function with different data every time", function () {
|
||||
var predA = new ConsecutiveDistinctPredicate(),
|
||||
data = { name : "Amelia" },
|
||||
res = [];
|
||||
res.push( predA( data ) );
|
||||
data.name = "Rose";
|
||||
res.push( predA( data ) );
|
||||
data.name = "Martha";
|
||||
res.push( predA( data ) );
|
||||
|
||||
it( "The first result should be true", function () {
|
||||
assert( res[0] ).isTrue();
|
||||
} );
|
||||
it( "The second result should be false", function () {
|
||||
assert( res[1] ).isFalse();
|
||||
} );
|
||||
it( "The first result should be true", function () {
|
||||
expect( res[0] ).to.be.ok();
|
||||
} );
|
||||
it( "The second result should be true", function () {
|
||||
expect( res[1] ).to.be.ok();
|
||||
} );
|
||||
it( "The third result should be true", function () {
|
||||
expect( res[2] ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
describe( "When calling the function with different data every two calls", function () {
|
||||
var predA = new ConsecutiveDistinctPredicate(),
|
||||
data = { name : "Amelia" },
|
||||
res = [];
|
||||
res.push( predA( data ) );
|
||||
res.push( predA( data ) );
|
||||
data.name = "Rose";
|
||||
res.push( predA( data ) );
|
||||
res.push( predA( data ) );
|
||||
data.name = "Martha";
|
||||
res.push( predA( data ) );
|
||||
res.push( predA( data ) );
|
||||
|
||||
it( "The third result should be isTrue", function () {
|
||||
assert( res[2] ).isTrue();
|
||||
} );
|
||||
it( "The fourth result should be false", function () {
|
||||
assert( res[3] ).isFalse();
|
||||
} );
|
||||
it( "The first result should be true", function () {
|
||||
expect( res[0] ).to.be.ok();
|
||||
} );
|
||||
it( "The second result should be false", function () {
|
||||
expect( res[1] ).to.not.be.ok()
|
||||
} );
|
||||
|
||||
it( "The fifth result should be true", function () {
|
||||
assert( res[4] ).isTrue();
|
||||
} );
|
||||
it( "The sixth result should be false", function () {
|
||||
assert( res[5] ).isFalse();
|
||||
} );
|
||||
it( "The third result should be isTrue", function () {
|
||||
expect( res[2] ).to.be.ok();
|
||||
} );
|
||||
it( "The fourth result should be false", function () {
|
||||
expect( res[3] ).to.not.be.ok()
|
||||
} );
|
||||
|
||||
it( "The fifth result should be true", function () {
|
||||
expect( res[4] ).to.be.ok();
|
||||
} );
|
||||
it( "The sixth result should be false", function () {
|
||||
expect( res[5] ).to.not.be.ok()
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
@ -1,198 +1,199 @@
|
|||
QUnit.specify('postal.js', function () {
|
||||
describe('DistinctPredicate', function () {
|
||||
describe( 'DistinctPredicate', function () {
|
||||
|
||||
describe('When calling the function with the same data object multiple times', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with the same data object multiple times', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred({career: 'ninja'}));
|
||||
results.push(pred({career: 'ninja'}));
|
||||
results.push(pred({career: 'ninja'}));
|
||||
results.push( pred( {career : 'ninja'} ) );
|
||||
results.push( pred( {career : 'ninja'} ) );
|
||||
results.push( pred( {career : 'ninja'} ) );
|
||||
|
||||
it('the first result should be true', function () {
|
||||
assert(results[0]).isTrue();
|
||||
});
|
||||
it('the second result should be false', function () {
|
||||
assert(results[1]).isFalse();
|
||||
});
|
||||
it('the third result should be false', function () {
|
||||
assert(results[2]).isFalse();
|
||||
});
|
||||
});
|
||||
it( 'the first result should be true', function () {
|
||||
expect( results[0] ).to.be.ok();
|
||||
} );
|
||||
it( 'the second result should be false', function () {
|
||||
expect( results[1] ).to.not.be.ok()
|
||||
} );
|
||||
it( 'the third result should be false', function () {
|
||||
expect( results[2] ).to.not.be.ok()
|
||||
} );
|
||||
} );
|
||||
|
||||
describe('When calling the function with the same primitive multiple times', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with the same primitive multiple times', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred('ninja'));
|
||||
results.push(pred('ninja'));
|
||||
results.push(pred('ninja'));
|
||||
results.push( pred( 'ninja' ) );
|
||||
results.push( pred( 'ninja' ) );
|
||||
results.push( pred( 'ninja' ) );
|
||||
|
||||
it('the first result should be true', function () {
|
||||
assert(results[0]).isTrue();
|
||||
});
|
||||
it('the second result should be false', function () {
|
||||
assert(results[1]).isFalse();
|
||||
});
|
||||
it('the third result should be false', function () {
|
||||
assert(results[2]).isFalse();
|
||||
});
|
||||
});
|
||||
it( 'the first result should be true', function () {
|
||||
expect( results[0] ).to.be.ok();
|
||||
} );
|
||||
it( 'the second result should be false', function () {
|
||||
expect( results[1] ).to.not.be.ok()
|
||||
} );
|
||||
it( 'the third result should be false', function () {
|
||||
expect( results[2] ).to.not.be.ok()
|
||||
} );
|
||||
} );
|
||||
|
||||
describe('When calling the function with the same array multiple times', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with the same array multiple times', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred(['Jack Black', 'Kyle Gass']));
|
||||
results.push(pred(['Jack Black', 'Kyle Gass']));
|
||||
results.push(pred(['Jack Black', 'Kyle Gass']));
|
||||
results.push( pred( ['Jack Black', 'Kyle Gass'] ) );
|
||||
results.push( pred( ['Jack Black', 'Kyle Gass'] ) );
|
||||
results.push( pred( ['Jack Black', 'Kyle Gass'] ) );
|
||||
|
||||
it('the first result should be true', function () {
|
||||
assert(results[0]).isTrue();
|
||||
});
|
||||
it('the second result should be false', function () {
|
||||
assert(results[1]).isFalse();
|
||||
});
|
||||
it('the third result should be false', function () {
|
||||
assert(results[2]).isFalse();
|
||||
});
|
||||
});
|
||||
it( 'the first result should be true', function () {
|
||||
expect( results[0] ).to.be.ok();
|
||||
} );
|
||||
it( 'the second result should be false', function () {
|
||||
expect( results[1] ).to.not.be.ok()
|
||||
} );
|
||||
it( 'the third result should be false', function () {
|
||||
expect( results[2] ).to.not.be.ok()
|
||||
} );
|
||||
} );
|
||||
|
||||
// ------------------------------------------
|
||||
// ------------------------------------------
|
||||
|
||||
describe('When calling the function with different data object every time', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with different data object every time', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred({codename: 'tinker'}));
|
||||
results.push(pred({codename: 'tailor'}));
|
||||
results.push(pred({codename: 'soldier'}));
|
||||
results.push(pred({codename: 'spy'}));
|
||||
results.push( pred( {codename : 'tinker'} ) );
|
||||
results.push( pred( {codename : 'tailor'} ) );
|
||||
results.push( pred( {codename : 'soldier'} ) );
|
||||
results.push( pred( {codename : 'spy'} ) );
|
||||
|
||||
it('all results should be true', function () {
|
||||
var i = 0, length = results.length;
|
||||
for (i; i < length; i += 1) {
|
||||
assert(results[i]).isTrue();
|
||||
}
|
||||
});
|
||||
});
|
||||
it( 'all results should be true', function () {
|
||||
var i = 0, length = results.length;
|
||||
for ( i; i < length; i += 1 ) {
|
||||
expect( results[i] ).to.be.ok();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
describe('When calling the function with different primitive every time', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with different primitive every time', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred(100.5));
|
||||
results.push(pred(12));
|
||||
results.push(pred(40.32));
|
||||
results.push(pred(0));
|
||||
results.push( pred( 100.5 ) );
|
||||
results.push( pred( 12 ) );
|
||||
results.push( pred( 40.32 ) );
|
||||
results.push( pred( 0 ) );
|
||||
|
||||
it('all results should be true', function () {
|
||||
var i = 0, length = results.length;
|
||||
for (i; i < length; i += 1) {
|
||||
assert(results[i]).isTrue();
|
||||
}
|
||||
});
|
||||
});
|
||||
it( 'all results should be true', function () {
|
||||
var i = 0, length = results.length;
|
||||
for ( i; i < length; i += 1 ) {
|
||||
expect( results[i] ).to.be.ok();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
describe('When calling the function with different array every time', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with different array every time', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred([]));
|
||||
results.push(pred(['chrome', 'firefox', 'ie', 'opera']));
|
||||
results.push(pred(['windows', 'linux', 'osx']));
|
||||
results.push(pred(['Leonardo', 'Raphael', 'Donatello', 'Michelangelo']));
|
||||
results.push( pred( [] ) );
|
||||
results.push( pred( ['chrome', 'firefox', 'ie', 'opera'] ) );
|
||||
results.push( pred( ['windows', 'linux', 'osx'] ) );
|
||||
results.push( pred( ['Leonardo', 'Raphael', 'Donatello', 'Michelangelo'] ) );
|
||||
|
||||
it('all results should be true', function () {
|
||||
var i = 0, length = results.length;
|
||||
for (i; i < length; i += 1) {
|
||||
assert(results[i]).isTrue();
|
||||
}
|
||||
});
|
||||
});
|
||||
it( 'all results should be true', function () {
|
||||
var i = 0, length = results.length;
|
||||
for ( i; i < length; i += 1 ) {
|
||||
expect( results[i] ).to.be.ok();
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
// ------------------------------------------
|
||||
// ------------------------------------------
|
||||
|
||||
describe('When calling the function with different data object between duplicates', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with different data object between duplicates', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred({game: 'Diablo 3'}));
|
||||
results.push(pred({game: 'Bioshock'}));
|
||||
results.push(pred({game: 'Batman: Arkham City'}));
|
||||
results.push(pred({game: 'Diablo 3'}));
|
||||
results.push(pred({game: 'Team Fortress 2'}));
|
||||
results.push( pred( {game : 'Diablo 3'} ) );
|
||||
results.push( pred( {game : 'Bioshock'} ) );
|
||||
results.push( pred( {game : 'Batman: Arkham City'} ) );
|
||||
results.push( pred( {game : 'Diablo 3'} ) );
|
||||
results.push( pred( {game : 'Team Fortress 2'} ) );
|
||||
|
||||
it('the first result should be true', function () {
|
||||
assert(results[0]).isTrue();
|
||||
});
|
||||
it('the second result should be true', function () {
|
||||
assert(results[1]).isTrue();
|
||||
});
|
||||
it('the third result should be true', function () {
|
||||
assert(results[2]).isTrue();
|
||||
});
|
||||
it('the fourth result should be false', function () {
|
||||
assert(results[3]).isFalse();
|
||||
});
|
||||
it('the fifth result should be true', function () {
|
||||
assert(results[4]).isTrue();
|
||||
});
|
||||
});
|
||||
it( 'the first result should be true', function () {
|
||||
expect( results[0] ).to.be.ok();
|
||||
} );
|
||||
it( 'the second result should be true', function () {
|
||||
expect( results[1] ).to.be.ok();
|
||||
} );
|
||||
it( 'the third result should be true', function () {
|
||||
expect( results[2] ).to.be.ok();
|
||||
} );
|
||||
it( 'the fourth result should be false', function () {
|
||||
expect( results[3] ).to.not.be.ok()
|
||||
} );
|
||||
it( 'the fifth result should be true', function () {
|
||||
expect( results[4] ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
|
||||
describe('When calling the function with different primitive between duplicates', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with different primitive between duplicates', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred('Stan Marsh'));
|
||||
results.push(pred('Kyle Broflovski'));
|
||||
results.push(pred('Eric Cartman'));
|
||||
results.push(pred('Stan Marsh'));
|
||||
results.push(pred('Kenny McCormick'));
|
||||
results.push( pred( 'Stan Marsh' ) );
|
||||
results.push( pred( 'Kyle Broflovski' ) );
|
||||
results.push( pred( 'Eric Cartman' ) );
|
||||
results.push( pred( 'Stan Marsh' ) );
|
||||
results.push( pred( 'Kenny McCormick' ) );
|
||||
|
||||
it('the first result should be true', function () {
|
||||
assert(results[0]).isTrue();
|
||||
});
|
||||
it('the second result should be true', function () {
|
||||
assert(results[1]).isTrue();
|
||||
});
|
||||
it('the third result should be true', function () {
|
||||
assert(results[2]).isTrue();
|
||||
});
|
||||
it('the fourth result should be false', function () {
|
||||
assert(results[3]).isFalse();
|
||||
});
|
||||
it('the fifth result should be true', function () {
|
||||
assert(results[4]).isTrue();
|
||||
});
|
||||
});
|
||||
it( 'the first result should be true', function () {
|
||||
expect( results[0] ).to.be.ok();
|
||||
} );
|
||||
it( 'the second result should be true', function () {
|
||||
expect( results[1] ).to.be.ok();
|
||||
} );
|
||||
it( 'the third result should be true', function () {
|
||||
expect( results[2] ).to.be.ok();
|
||||
} );
|
||||
it( 'the fourth result should be false', function () {
|
||||
expect( results[3] ).to.not.be.ok()
|
||||
} );
|
||||
it( 'the fifth result should be true', function () {
|
||||
expect( results[4] ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
|
||||
describe('When calling the function with different array between duplicates', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
describe( 'When calling the function with different array between duplicates', function () {
|
||||
var pred = new DistinctPredicate(),
|
||||
results = [];
|
||||
|
||||
results.push(pred([]));
|
||||
results.push(pred(['Hannibal', 'Face', 'Murdock', 'Mr. T']));
|
||||
results.push(pred([4, 8, 15, 16, 23, 42]));
|
||||
results.push(pred([]));
|
||||
results.push(pred([{x: 10, y: 20}, {x: 50, y: 100}]));
|
||||
results.push( pred( [] ) );
|
||||
results.push( pred( ['Hannibal', 'Face', 'Murdock', 'Mr. T'] ) );
|
||||
results.push( pred( [4, 8, 15, 16, 23, 42] ) );
|
||||
results.push( pred( [] ) );
|
||||
results.push( pred( [
|
||||
{x : 10, y : 20},
|
||||
{x : 50, y : 100}
|
||||
] ) );
|
||||
|
||||
it('the first result should be true', function () {
|
||||
assert(results[0]).isTrue();
|
||||
});
|
||||
it('the second result should be true', function () {
|
||||
assert(results[1]).isTrue();
|
||||
});
|
||||
it('the third result should be true', function () {
|
||||
assert(results[2]).isTrue();
|
||||
});
|
||||
it('the fourth result should be false', function () {
|
||||
assert(results[3]).isFalse();
|
||||
});
|
||||
it('the fifth result should be true', function () {
|
||||
assert(results[4]).isTrue();
|
||||
});
|
||||
});
|
||||
it( 'the first result should be true', function () {
|
||||
expect( results[0] ).to.be.ok();
|
||||
} );
|
||||
it( 'the second result should be true', function () {
|
||||
expect( results[1] ).to.be.ok();
|
||||
} );
|
||||
it( 'the third result should be true', function () {
|
||||
expect( results[2] ).to.be.ok();
|
||||
} );
|
||||
it( 'the fourth result should be false', function () {
|
||||
expect( results[3] ).to.not.be.ok()
|
||||
} );
|
||||
it( 'the fifth result should be true', function () {
|
||||
expect( results[4] ).to.be.ok();
|
||||
} );
|
||||
} );
|
||||
|
||||
});
|
||||
});
|
||||
} );
|
||||
1640
spec/Postal.spec.js
1640
spec/Postal.spec.js
File diff suppressed because it is too large
Load diff
|
|
@ -1,200 +1,197 @@
|
|||
QUnit.specify( "postal.js", function () {
|
||||
describe( "SubscriptionDefinition", function () {
|
||||
describe( "When initializing SubscriptionDefinition", function () {
|
||||
var sDef,
|
||||
caughtSubscribeEvent,
|
||||
systemSubscription;
|
||||
before( function () {
|
||||
systemSubscription = postal.subscribe( {
|
||||
channel : "postal",
|
||||
topic : "subscription.created",
|
||||
callback : function ( data, envelope ) {
|
||||
if ( data.event &&
|
||||
data.event == "subscription.created" &&
|
||||
data.channel == "SubDefTestChannel" &&
|
||||
data.topic == "SubDefTestTopic" ) {
|
||||
caughtSubscribeEvent = true;
|
||||
}
|
||||
describe( "SubscriptionDefinition", function () {
|
||||
describe( "When initializing SubscriptionDefinition", function () {
|
||||
var sDef,
|
||||
caughtSubscribeEvent,
|
||||
systemSubscription;
|
||||
before( function () {
|
||||
systemSubscription = postal.subscribe( {
|
||||
channel : "postal",
|
||||
topic : "subscription.created",
|
||||
callback : function ( data, envelope ) {
|
||||
if ( data.event &&
|
||||
data.event == "subscription.created" &&
|
||||
data.channel == "SubDefTestChannel" &&
|
||||
data.topic == "SubDefTestTopic" ) {
|
||||
caughtSubscribeEvent = true;
|
||||
}
|
||||
} );
|
||||
sDef = new SubscriptionDefinition( "SubDefTestChannel", "SubDefTestTopic", NO_OP );
|
||||
} );
|
||||
after( function () {
|
||||
sDef.unsubscribe();
|
||||
systemSubscription.unsubscribe();
|
||||
caughtSubscribeEvent = false;
|
||||
} );
|
||||
it( "should set the channel to SubDefTestChannel", function () {
|
||||
assert( sDef.channel ).equals( "SubDefTestChannel" );
|
||||
} );
|
||||
it( "should set the topic to SubDefTestTopic", function () {
|
||||
assert( sDef.topic ).equals( "SubDefTestTopic" );
|
||||
} );
|
||||
it( "should set the callback", function () {
|
||||
assert( sDef.callback ).equals( NO_OP );
|
||||
} );
|
||||
it( "should default the priority", function () {
|
||||
assert( sDef.priority ).equals( 50 );
|
||||
} );
|
||||
it( "should default the constraints", function () {
|
||||
assert( sDef.constraints.length ).equals( 0 );
|
||||
} );
|
||||
it( "should default the maxCalls", function () {
|
||||
assert( sDef.maxCalls ).equals( 0 );
|
||||
} );
|
||||
it( "should default the onHandled callback", function () {
|
||||
assert( sDef.onHandled ).equals( NO_OP );
|
||||
} );
|
||||
it( "should default the context", function () {
|
||||
assert( sDef.context ).isNull();
|
||||
} );
|
||||
it( "should fire the subscription.created message", function () {
|
||||
assert( caughtSubscribeEvent ).equals( true );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When setting distinctUntilChanged", function () {
|
||||
var sDefa = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).distinctUntilChanged();
|
||||
|
||||
it( "Should add a DistinctPredicate constraint to the configuration constraints", function () {
|
||||
assert( sDefa.constraints.length ).equals( 1 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When adding a constraint", function () {
|
||||
var sDefb = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withConstraint( function () {
|
||||
} );
|
||||
|
||||
it( "Should add a constraint", function () {
|
||||
assert( sDefb.constraints.length ).equals( 1 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When adding multiple constraints", function () {
|
||||
var sDefc = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withConstraints( [function () {
|
||||
}, function () {
|
||||
}, function () {
|
||||
}] );
|
||||
|
||||
it( "Should add a constraint", function () {
|
||||
assert( sDefc.constraints.length ).equals( 3 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When setting the context", function () {
|
||||
var obj = {},
|
||||
sDefd = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withContext( obj );
|
||||
|
||||
it( "Should set context", function () {
|
||||
assert( sDefd.context ).equals( obj );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When setting priority", function () {
|
||||
var sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withPriority( 10 );
|
||||
|
||||
it( "Should set priority", function () {
|
||||
assert( sDefe.priority ).equals( 10 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When calling subscribe to set the callback", function () {
|
||||
var sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ),
|
||||
fn = function () {
|
||||
};
|
||||
sDefe.subscribe( fn );
|
||||
|
||||
it( "Should set the callback", function () {
|
||||
assert( sDefe.callback ).equals( fn );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When deferring the callback", function () {
|
||||
var results = [],
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
} ).defer();
|
||||
sDefe.callback( "second" );
|
||||
results.push( "first" );
|
||||
|
||||
it( "Should defer the callback", function () {
|
||||
wait( 1, function () {
|
||||
assert( results[0] ).equals( "first" );
|
||||
assert( results[1] ).equals( "second" );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When delaying the callback", function () {
|
||||
var results = [],
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
} ).withDelay( 200 );
|
||||
sDefe.callback( "second" );
|
||||
results.push( "first" );
|
||||
|
||||
it( "Should delay the callback", function () {
|
||||
wait( 300, function () {
|
||||
assert( results[0] ).equals( "first" );
|
||||
assert( results[1] ).equals( "second" );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When debouncing the callback", function () {
|
||||
var results = [],
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
} ).withDebounce( 800 );
|
||||
|
||||
it( "should have only invoked debounced callback once", async( function () {
|
||||
sDefe.callback( 1 ); // starts the two second clock on debounce
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 2 );
|
||||
}, 20 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 3 );
|
||||
}, 80 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 4 );
|
||||
}, 250 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 5 );
|
||||
}, 500 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 6 );
|
||||
}, 1000 ); // should invoke callback
|
||||
setTimeout( function () {
|
||||
assert( results[0] ).equals( 6 );
|
||||
assert( results.length ).equals( 1 );
|
||||
resume();
|
||||
}, 2400 );
|
||||
} ) );
|
||||
} );
|
||||
|
||||
describe( "When throttling the callback", function () {
|
||||
var results = [],
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
} ).withThrottle( 500 );
|
||||
|
||||
it( "should have only invoked throttled callback twice", async( function () {
|
||||
sDefe.callback( 1 ); // starts the two second clock on debounce
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 800 );
|
||||
}, 800 ); // should invoke callback
|
||||
for ( var i = 0; i < 20; i++ ) {
|
||||
(function ( x ) {
|
||||
sDefe.callback( x );
|
||||
})( i );
|
||||
}
|
||||
setTimeout( function () {
|
||||
assert( results[0] ).equals( 1 );
|
||||
assert( results[1] ).equals( 800 );
|
||||
assert( results.length ).equals( 2 );
|
||||
resume();
|
||||
}, 1500 );
|
||||
} ) );
|
||||
} );
|
||||
sDef = new SubscriptionDefinition( "SubDefTestChannel", "SubDefTestTopic", NO_OP );
|
||||
} );
|
||||
after( function () {
|
||||
sDef.unsubscribe();
|
||||
systemSubscription.unsubscribe();
|
||||
caughtSubscribeEvent = false;
|
||||
} );
|
||||
it( "should set the channel to SubDefTestChannel", function () {
|
||||
expect( sDef.channel ).to.be( "SubDefTestChannel" );
|
||||
} );
|
||||
it( "should set the topic to SubDefTestTopic", function () {
|
||||
expect( sDef.topic ).to.be( "SubDefTestTopic" );
|
||||
} );
|
||||
it( "should set the callback", function () {
|
||||
expect( sDef.callback ).to.be( NO_OP );
|
||||
} );
|
||||
it( "should default the priority", function () {
|
||||
expect( sDef.priority ).to.be( 50 );
|
||||
} );
|
||||
it( "should default the constraints", function () {
|
||||
expect( sDef.constraints.length ).to.be( 0 );
|
||||
} );
|
||||
it( "should default the maxCalls", function () {
|
||||
expect( sDef.maxCalls ).to.be( 0 );
|
||||
} );
|
||||
it( "should default the onHandled callback", function () {
|
||||
expect( sDef.onHandled ).to.be( NO_OP );
|
||||
} );
|
||||
it( "should default the context", function () {
|
||||
expect( sDef.context ).to.be(null);
|
||||
} );
|
||||
it( "should fire the subscription.created message", function () {
|
||||
expect( caughtSubscribeEvent ).to.be( true );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When setting distinctUntilChanged", function () {
|
||||
var sDefa = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).distinctUntilChanged();
|
||||
|
||||
it( "Should add a DistinctPredicate constraint to the configuration constraints", function () {
|
||||
expect( sDefa.constraints.length ).to.be( 1 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When adding a constraint", function () {
|
||||
var sDefb = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withConstraint( function () {
|
||||
} );
|
||||
|
||||
it( "Should add a constraint", function () {
|
||||
expect( sDefb.constraints.length ).to.be( 1 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When adding multiple constraints", function () {
|
||||
var sDefc = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withConstraints( [function () {
|
||||
}, function () {
|
||||
}, function () {
|
||||
}] );
|
||||
|
||||
it( "Should add a constraint", function () {
|
||||
expect( sDefc.constraints.length ).to.be( 3 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When setting the context", function () {
|
||||
var obj = {},
|
||||
sDefd = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withContext( obj );
|
||||
|
||||
it( "Should set context", function () {
|
||||
expect( sDefd.context ).to.be( obj );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When setting priority", function () {
|
||||
var sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ).withPriority( 10 );
|
||||
|
||||
it( "Should set priority", function () {
|
||||
expect( sDefe.priority ).to.be( 10 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When calling subscribe to set the callback", function () {
|
||||
var sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", NO_OP ),
|
||||
fn = function () {
|
||||
};
|
||||
sDefe.subscribe( fn );
|
||||
|
||||
it( "Should set the callback", function () {
|
||||
expect( sDefe.callback ).to.be( fn );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When deferring the callback", function () {
|
||||
var results = [], sDefe;
|
||||
|
||||
it( "Should defer the callback", function (done) {
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
expect( results[0] ).to.be( "first" );
|
||||
expect( results[1] ).to.be( "second" );
|
||||
done();
|
||||
} ).defer();
|
||||
|
||||
sDefe.callback( "second" );
|
||||
results.push( "first" );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When delaying the callback", function () {
|
||||
var results = [], sDefe;
|
||||
|
||||
it( "Should delay the callback", function (done) {
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
expect( results[0] ).to.be( "first" );
|
||||
expect( results[1] ).to.be( "second" );
|
||||
done();
|
||||
} ).withDelay( 200 );
|
||||
sDefe.callback( "second" );
|
||||
results.push( "first" );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When debouncing the callback", function () {
|
||||
var results = [],
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
} ).withDebounce( 800 );
|
||||
|
||||
it( "should have only invoked debounced callback once", function (done) {
|
||||
sDefe.callback( 1 ); // starts the two second clock on debounce
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 2 );
|
||||
}, 20 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 3 );
|
||||
}, 80 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 4 );
|
||||
}, 250 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 5 );
|
||||
}, 500 ); // should not invoke callback
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 6 );
|
||||
}, 1000 ); // should invoke callback
|
||||
setTimeout( function () {
|
||||
expect( results[0] ).to.be( 6 );
|
||||
expect( results.length ).to.be( 1 );
|
||||
done();
|
||||
}, 2400 );
|
||||
} );
|
||||
} );
|
||||
|
||||
describe( "When throttling the callback", function () {
|
||||
var results = [],
|
||||
sDefe = new SubscriptionDefinition( "TestChannel", "TestTopic", function ( data ) {
|
||||
results.push( data );
|
||||
} ).withThrottle( 500 );
|
||||
|
||||
it( "should have only invoked throttled callback twice", function (done) {
|
||||
sDefe.callback( 1 ); // starts the two second clock on debounce
|
||||
setTimeout( function () {
|
||||
sDefe.callback( 800 );
|
||||
}, 800 ); // should invoke callback
|
||||
for ( var i = 0; i < 20; i++ ) {
|
||||
(function ( x ) {
|
||||
sDefe.callback( x );
|
||||
})( i );
|
||||
}
|
||||
setTimeout( function () {
|
||||
expect( results[0] ).to.be( 1 );
|
||||
expect( results[1] ).to.be( 800 );
|
||||
expect( results.length ).to.be( 2 );
|
||||
done();
|
||||
}, 1500 );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
|
@ -1,39 +1,39 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="../ext/jquery-1.5.2.js"></script>
|
||||
<script type="text/javascript" src="../ext/qunit.js"></script>
|
||||
<script type="text/javascript" src="../ext/pavlov.js"></script>
|
||||
<script type="text/javascript" src="../ext/amplify.core.js"></script>
|
||||
<script type="text/javascript" src="../ext/amplify.store.js"></script>
|
||||
<script type="text/javascript" src="../ext/underscore.js"></script>
|
||||
<script type="text/javascript" src="../src/Constants.js"></script>
|
||||
<script type="text/javascript" src="../src/DistinctPredicate.js"></script>
|
||||
<script type="text/javascript" src="../src/ConsecutiveDistinctPredicate.js"></script>
|
||||
<script type="text/javascript" src="../src/ChannelDefinition.js"></script>
|
||||
<script type="text/javascript" src="../src/SubscriptionDefinition.js"></script>
|
||||
<script type="text/javascript" src="../src/BindingsResolver.js"></script>
|
||||
<script type="text/javascript" src="../src/AmqpBindingsResolver.js"></script>
|
||||
<script type="text/javascript" src="../src/LocalBus.js"></script>
|
||||
<script type="text/javascript" src="../src/Api.js"></script>
|
||||
<script type="text/javascript" src="DistinctPredicate.spec.js"></script>
|
||||
<script type="text/javascript" src="ConsecutiveDistinctPredicate.spec.js"></script>
|
||||
<script type="text/javascript" src="ChannelDefinition.spec.js"></script>
|
||||
<script type="text/javascript" src="SubscriptionDefinition.spec.js"></script>
|
||||
<script type="text/javascript" src="BindingsResolver.spec.js"></script>
|
||||
<script type="text/javascript" src="AmqpBindingsResolver.spec.js"></script>
|
||||
<script type="text/javascript" src="Postal.spec.js"></script>
|
||||
<!--<script type="text/javascript" src="../lib/browser/postal.diagnostics.js"></script>-->
|
||||
<link rel="stylesheet" href="../ext/qunit.css" type="text/css" media="screen"/>
|
||||
<link rel="stylesheet" href="/ext/mocha.css" />
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="qunit-header"></h1>
|
||||
|
||||
<h2 id="qunit-banner"></h2>
|
||||
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
<div id="mocha"></div>
|
||||
<script type="text/javascript" src="/ext/jquery-1.7.1.js"></script>
|
||||
<script type="text/javascript" src="/ext/underscore.js"></script>
|
||||
<script src="/ext/expect.js"></script>
|
||||
<script src="/ext/mocha.js"></script>
|
||||
<script type="text/javascript">
|
||||
mocha.setup({ ui: 'bdd', timeout: 60000, ignoreLeaks: true });
|
||||
</script>
|
||||
<script type="text/javascript" src="../ext/amplify.core.js"></script>
|
||||
<script type="text/javascript" src="../ext/amplify.store.js"></script>
|
||||
<script type="text/javascript" src="../ext/underscore.js"></script>
|
||||
<script type="text/javascript" src="../src/Constants.js"></script>
|
||||
<script type="text/javascript" src="../src/DistinctPredicate.js"></script>
|
||||
<script type="text/javascript" src="../src/ConsecutiveDistinctPredicate.js"></script>
|
||||
<script type="text/javascript" src="../src/ChannelDefinition.js"></script>
|
||||
<script type="text/javascript" src="../src/SubscriptionDefinition.js"></script>
|
||||
<script type="text/javascript" src="../src/BindingsResolver.js"></script>
|
||||
<script type="text/javascript" src="../src/AmqpBindingsResolver.js"></script>
|
||||
<script type="text/javascript" src="../src/LocalBus.js"></script>
|
||||
<script type="text/javascript" src="../src/Api.js"></script>
|
||||
<script type="text/javascript" src="DistinctPredicate.spec.js"></script>
|
||||
<script type="text/javascript" src="ConsecutiveDistinctPredicate.spec.js"></script>
|
||||
<script type="text/javascript" src="ChannelDefinition.spec.js"></script>
|
||||
<script type="text/javascript" src="SubscriptionDefinition.spec.js"></script>
|
||||
<script type="text/javascript" src="BindingsResolver.spec.js"></script>
|
||||
<script type="text/javascript" src="AmqpBindingsResolver.spec.js"></script>
|
||||
<script type="text/javascript" src="Postal.spec.js"></script>
|
||||
<script type="text/javascript">
|
||||
mocha.run();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue