mojito-dimensions-base
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -176,3 +176,4 @@ /* | ||
test, | ||
found; | ||
found, | ||
error; | ||
@@ -198,3 +199,7 @@ cacheValue = store._validateContextCache[cacheKey]; | ||
store._validateContextCache[cacheKey] = 'INVALID dimension key "' + k + '"'; | ||
throw new Error(store._validateContextCache[cacheKey]); | ||
error = new Error(store._validateContextCache[cacheKey]); | ||
if (isExperimentDimension(k)) { | ||
error.code = 400; //bad request | ||
} | ||
throw error; | ||
} | ||
@@ -201,0 +206,0 @@ // we need to support language fallbacks |
{ | ||
"name": "mojito-dimensions-base", | ||
"description": "Mojito bucket testing infrastructure Super Bundle Addon", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": "David Gomez <dgomez@yahoo-inc.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -19,3 +19,3 @@ # mojito-dimensions-base | ||
Experiments `super-bundle` packages are special types of mojito `bundles`, wich contain multiple versions of mojits that can be chosen at runtime through the dimension values using mojito `selectors` infrastructure. | ||
Experiments `super-bundle` packages are special types of mojito `bundles`, which contain multiple versions of mojits that can be chosen at runtime through the dimension values using mojito `selectors` infrastructure. | ||
@@ -33,3 +33,3 @@ ### Contexts and dimensions | ||
We create an experiment _super-bundle_ package `mojito-dimensions-experiment_foo`, | ||
which contains multipe versions of `Mojit1` based on the value of the dimension the package represents. | ||
which contains multiple versions of `Mojit1` based on the value of the dimension the package represents. | ||
@@ -36,0 +36,0 @@ Consider for the pupose of the example a layer named `foo`, whose values can be `EXP001, EXP002, EXP003`. |
@@ -229,3 +229,2 @@ /* | ||
error: { | ||
'validateContext with invalid dimension should fail': 'INVALID dimension key "experiment_foo"', | ||
'validateContext with invalid dimension value should fail': 'INVALID dimension value "invalid" for key "device"', | ||
@@ -249,2 +248,21 @@ 'validateContext with invalid lang value should fail': 'INVALID dimension value "invalid" for key "lang"', | ||
'test preloadPackage with non-super-bundle package': function () { | ||
var name = 'some-package', | ||
pkgInfo = { | ||
pkg: { | ||
name: name, | ||
yahoo: { | ||
mojito: { | ||
type: 'bundle' | ||
} | ||
} | ||
} | ||
}, | ||
path = libpath.join(superBundlePath, name); | ||
store._preloadPackage(pkgInfo); | ||
A.isUndefined(store._packagesVisited[name], 'Packages visited'); | ||
A.isUndefined(store._dirBundlesLoaded[path], 'Loaded bundle'); | ||
}, | ||
'test parseResourceVersion': function () { | ||
@@ -322,5 +340,10 @@ var res = store.parseResourceVersion(source, type, subtype, mojitType); | ||
'validateContext with invalid dimension should fail': function () { | ||
'validateContext with invalid dimension should fail with invalid request': function () { | ||
var invalidCtx = { experiment_foo: 'BAR'}; | ||
store.validateContext(invalidCtx); | ||
try { | ||
store.validateContext(invalidCtx); | ||
} catch (err) { | ||
A.areEqual('INVALID dimension key "experiment_foo"', err.message, 'Error message'); | ||
A.areEqual(400, err.code, 'Error code'); | ||
} | ||
}, | ||
@@ -327,0 +350,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42795
790