mojito-dimensions-base
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -44,2 +44,10 @@ /* | ||
resourceDepthAsc = function (a, b) { | ||
var da = a.source.pkg.depth, | ||
db = b.source.pkg.depth; | ||
if (da < db) { return -1; } | ||
if (da > db) { return 1; } | ||
return 0; | ||
}, | ||
dimensions = [], | ||
@@ -159,2 +167,3 @@ appConfigs = []; | ||
this.beforeHostMethod('addResourceVersion', this.addResourceVersion, this); | ||
this.afterHostMethod('getResourceVersions', this.getResourceVersions, this); | ||
this.afterHostMethod('parseResourceVersion', this.parseResourceVersion, this); | ||
@@ -292,2 +301,15 @@ this.onHostEvent('resolveMojitDetails', this.resolveMojitDetails, this); | ||
getResourceVersions: function (filter) { | ||
var self = this, | ||
res = Y.Do.currentRetVal, | ||
versions; | ||
if (filter.type === 'mojit' && filter.name !== 'shared' && filter.selector === '*' && | ||
res.length === 0) { | ||
res = self.store.getResourceVersions({ type: 'mojit', name: filter.name }); | ||
res.sort(resourceDepthAsc); | ||
} | ||
return new Y.Do.AlterReturn(null, res); | ||
}, | ||
/** | ||
@@ -362,3 +384,3 @@ * Hook in to replace the selector with the experiment bundle name. | ||
res.selector = res.source.pkg.bundle; | ||
} | ||
} | ||
}, | ||
@@ -365,0 +387,0 @@ |
@@ -15,1 +15,9 @@ CHANGELOG | ||
* Expose experiment package's dimension name and value at runtime through properties `dimensionName` and `dimensionValue` of the mojit details metadata. | ||
Version 0.0.6 | ||
------------- | ||
* Generate urls with selector for static assets. | ||
Version 0.0.8 | ||
------------- | ||
* Fix for testing a experiment package with `mojito test`. |
{ | ||
"name": "mojito-dimensions-base", | ||
"description": "Mojito bucket testing infrastructure Super Bundle Addon", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"author": "David Gomez <dgomez@yahoo-inc.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -120,2 +120,34 @@ /* | ||
getResourceVersions: function (filter) { | ||
//to be tested on addon (plugin) | ||
if (filter.selector === '*') { | ||
return []; | ||
} | ||
return [{ | ||
source: { | ||
pkg: { | ||
depth: 2 | ||
} | ||
} | ||
}, { | ||
source: { | ||
pkg: { | ||
depth: 3 | ||
} | ||
} | ||
}, { | ||
source: { | ||
pkg: { | ||
depth: 1 | ||
} | ||
} | ||
}, { | ||
source: { | ||
pkg: { | ||
depth: 2 | ||
} | ||
} | ||
}]; | ||
}, | ||
resolveMojitDetails: function (env, posl, type, ress, mojitRes) { | ||
@@ -447,2 +479,18 @@ var details = {}; | ||
A.areEqual(source.pkg.bundle, details.dimensionValue, "Mojit details dimension value"); | ||
}, | ||
'getResourceVersions should return shallowest resource if mojit resource with * selector is not found' : function () { | ||
var filter = { | ||
type: 'mojit', | ||
name: 'FooMojit', | ||
selector: '*' | ||
}, | ||
versions = store.getResourceVersions(filter), | ||
resource; | ||
A.isArray(versions, 'resource versions'); | ||
A.areEqual(4, versions.length, 'versions length'); | ||
resource = versions[0]; | ||
A.isObject(resource, 'resource'); | ||
A.areEqual(1, resource.source.pkg.depth, 'resource package depth'); | ||
} | ||
@@ -449,0 +497,0 @@ })); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
46531
880
0