Created
January 15, 2014 20:28
-
-
Save ericf/8443907 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
exports | |
.local | |
✓ should have a .local property | |
✓ should be the string "state" | |
.namespace | |
✓ should have a .namespace property | |
✓ should be null | |
.extend | |
✓ should have a .extend property | |
✓ should respond to .extend() | |
✓ should always return the Express app being extended | |
Exposed | |
✓ should be a function | |
.create( [exposed] ) | |
✓ should respond to .create() | |
✓ should be an `Exposed` instance factory | |
inhert `exposed` | |
✓ should inherit from the specified `exposed` | |
✓ should inherit previous namespaces | |
✓ should inherit new namespaces | |
✓ should not expose own namespaces to super | |
.isExposed( [obj] ) | |
✓ should respond to .isExposed() | |
✓ should return `true` for Exposed instances | |
✓ should return `true` for Exposed-like objects | |
✓ should return `false` for non-Exposed-like objects | |
#add( namespace, value [, options] ) | |
✓ should be a function | |
✓ should add the specified `namespace` as a property | |
✓ should add a deep `namespace` as a shallow property | |
✓ should clean up non-applicable namespaces | |
✓ should assign the specified `value` to the property | |
✓ should assign values by reference | |
✓ should not modify exsiting values | |
✓ should accept an `options` argument | |
✓ should not cache serialized values when `options.cache` is falsy | |
✓ should cache serialized values when `options.cache` is truthy | |
#toString() | |
✓ should be a function | |
✓ should return a string | |
✓ should initialize its namespaces | |
✓ should initialize deep namespaces | |
✓ should assign `value` to `namespace` | |
✓ should assign values to namespaces in order | |
✓ should assign values to sub namespaces | |
multiple | |
.extend( app ) | |
✓ should add `expose()` | |
✓ should not override `expose()` if it exists | |
serialize( obj ) | |
✓ should be a function | |
undefined | |
✓ should serialize `undefined` to a string | |
✓ should deserialize "undefined" to `undefined` | |
null | |
✓ should serialize `null` to a string | |
✓ should deserialize "null" to `null` | |
JSON | |
✓ should serialize JSON to a JSON string | |
✓ should deserialize a JSON string to a JSON object | |
functions | |
✓ should serialize annonymous functions | |
✓ should deserialize annonymous functions | |
✓ should serialize named functions | |
✓ should deserialize named functions | |
✓ should serialize functions with arguments | |
✓ should deserialize functions with arguments | |
✓ should serialize functions with bodies | |
✓ should deserialize functions with bodies | |
✓ should throw a TypeError when serializing native built-ins | |
regexps | |
✓ should serialize constructed regexps | |
✓ should deserialize constructed regexps | |
✓ should serialize literal regexps | |
✓ should deserialize literal regexps | |
✓ should serialize regexps with flags | |
✓ should deserialize regexps with flags | |
✓ should serialize regexps with escaped chars | |
✓ should deserialize regexps with escaped chars | |
XSS | |
✓ should encode unsafe HTML chars to Unicode | |
state | |
expose( obj [[, namespace [, options]] | [, options]] ) | |
✓ should add a `state` object to `locals` when called | |
✓ should not expose non-objects with no namespace | |
✓ should expose objects with no namespace by using its keys | |
DEPRECATED: expose( obj [, namespace [, local]] ) | |
✓ should use `local` when it is the third argument | |
global .local | |
✓ should create the exposed object at the specified `local` | |
✓ should be overridable when calling expose() | |
global .namespace | |
✓ should be used when no namespace is provided | |
✓ should be used as a prefix to the `namespace` provided | |
✓ should prefix the specified `namespace` when not already contained | |
✓ should be overrideable with a `window.` prefixed `namespace` | |
app.expose() | |
✓ should respond to expose() | |
setting: "state local" | |
✓ should use app setting | |
✓ should be preferred over the global .local | |
✓ should be overrideable when calling app.expose() | |
setting: "state namespace" | |
✓ should use app setting | |
✓ should be preferred over the global .namespace | |
✓ should be used as a prefix to the `namespace` provided | |
✓ should prefix the specified `namespace` when not already contained | |
✓ should be overrideable with a `window.` prefixed `namespace` | |
res.expose() | |
✓ should respond to expose() | |
✓ should inherit from app.locals | |
✓ should override app.locals | |
84 tests complete (112 ms) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment