How to use the wilson/application.primary function in wilson

To help you get started, we’ve selected a few wilson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chrisdickinson / wilson / tests / application.js View on Github external
function(assert) {
        "Primary returns app instance if it is marked as primary and has the appropriate tag";
        var randomTag = 'rand-'+Math.random(),
            mockObject = {
                'isPrimary':true,
                'app':{
                    'provides':[randomTag],
                }
            };
        assert.strictEqual(mockObject, application.primary(randomTag)(mockObject));
    },
    function(assert) {
github chrisdickinson / wilson / tests / application.js View on Github external
function(assert) {
        "Primary returns undefined if an app instance does not provide the tag";
        var randomTag = 'rand-'+Math.random(),
            otherTag = 'otherrand-'+Math.random(),
            mockObject = {
                'isPrimary':true,
                'app':{
                    'provides':[randomTag],
                }
            };
        assert.strictEqual(undefined, application.primary(otherTag)(mockObject));
    },
    function(assert) {
github chrisdickinson / wilson / tests / application.js View on Github external
assert.throws(Error, function() {
            appInstance.resolveAppDependency(application.primary(randomTag), app_dict);
        });
    },
github chrisdickinson / wilson / tests / application.js View on Github external
function(assert) {
        "Selection functions return functions that take application instances";
        var randomTag = 'rand-'+Math.random();
        assert.isInstance(application.any(randomTag), Function);
        assert.isInstance(application.primary(randomTag), Function);
        assert.isInstance(application.specific(randomTag), Function);
    },
    function(assert) {