@unleash/client-specification
Advanced tools
Comparing version 5.0.0 to 5.0.1
{ | ||
"name": "@unleash/client-specification", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "A collection of test specifications to guide client implementations in various languages", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -5,8 +5,9 @@ 'use strict'; | ||
function getTarget (name, id, total) { | ||
return (murmurHash3.x86.hash32(`${name}:${id}`) % total) + 1; | ||
function getTarget (name, id, total, seed) { | ||
console.log(`Hashing ${name}:${id} with seed ${seed}`); | ||
return (murmurHash3.x86.hash32(`${name}:${id}`, seed) % total) + 1; | ||
} | ||
function findTarget (name, total, wantedTarget) { | ||
function findTarget (name, total, wantedTarget, seed) { | ||
let found = false; | ||
@@ -17,3 +18,3 @@ let iterations = 0; | ||
const id = Math.round(Math.random() * Math.random() * 1000); | ||
const target = getTarget(name, id, total); | ||
const target = getTarget(name, id, total, seed); | ||
if (target === wantedTarget) { | ||
@@ -38,9 +39,10 @@ console.log(`If you give userId "${id}" with toggleName "${name}" it will give you allocation "${target}"`); | ||
const [bin, file, name, total, wanted] = process.argv; | ||
const [bin, file, name, total, wanted, seed] = process.argv; | ||
if (!name || !total || !wanted) { | ||
console.error(`Usage: | ||
$ node scripts/generate-wanted-hash.js toggleName 100 25 | ||
$ node scripts/generate-wanted-hash.js toggleName 100 25 <seed> | ||
100 = total number | ||
25 = wanted allocation | ||
<seed> = seed to use to murmur. Default to 0 | ||
@@ -52,3 +54,3 @@ `); | ||
findTarget(String(name), Number(total), Number(wanted)); | ||
findTarget(String(name), Number(total), Number(wanted), Number(seed || 0)); | ||
@@ -258,3 +258,3 @@ { | ||
{ | ||
"description": "Feature.Variants.B should be enabled for user 2", | ||
"description": "Feature.Variants.B should give variant2 for user 2", | ||
"context": { | ||
@@ -265,3 +265,3 @@ "userId": "2" | ||
"expectedResult": { | ||
"name": "variant1", | ||
"name": "variant2", | ||
"payload": { | ||
@@ -275,3 +275,3 @@ "type": "string", | ||
{ | ||
"description": "Feature.Variants.B should be enabled for user 0", | ||
"description": "Feature.Variants.B should give variant 1 for user 0", | ||
"context": { | ||
@@ -282,3 +282,3 @@ "userId": "0" | ||
"expectedResult": { | ||
"name": "variant2", | ||
"name": "variant1", | ||
"payload": { | ||
@@ -294,3 +294,3 @@ "type": "string", | ||
"context": { | ||
"userId": "315" | ||
"userId": "232" | ||
}, | ||
@@ -310,3 +310,3 @@ "toggleName": "Feature.Variants.C", | ||
"context": { | ||
"userId": "320" | ||
"userId": "607" | ||
}, | ||
@@ -326,3 +326,3 @@ "toggleName": "Feature.Variants.C", | ||
"context": { | ||
"userId": "729" | ||
"userId": "656" | ||
}, | ||
@@ -342,3 +342,3 @@ "toggleName": "Feature.Variants.C", | ||
"context": { | ||
"userId": "367" | ||
"userId": "712" | ||
}, | ||
@@ -358,3 +358,3 @@ "toggleName": "Feature.Variants.D", | ||
"context": { | ||
"userId": "31" | ||
"userId": "525" | ||
}, | ||
@@ -374,3 +374,3 @@ "toggleName": "Feature.Variants.D", | ||
"context": { | ||
"userId": "19" | ||
"userId": "537" | ||
}, | ||
@@ -418,5 +418,5 @@ "toggleName": "Feature.Variants.D", | ||
{ | ||
"description": "Feature.Variants.override.D should return variant2 for user 82", | ||
"description": "Feature.Variants.override.D should return variant2 for user 388", | ||
"context": { | ||
"userId": "82" | ||
"userId": "388" | ||
}, | ||
@@ -423,0 +423,0 @@ "toggleName": "Feature.Variants.override.D", |
@@ -118,5 +118,5 @@ { | ||
{ | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=528 yields blue", | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=616 yields blue", | ||
"context": { | ||
"properties": {"customField": "528"} | ||
"properties": {"customField": "616"} | ||
}, | ||
@@ -134,23 +134,8 @@ "toggleName": "Feature.flexible.rollout.custom.stickiness_100", | ||
{ | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=16 yields blue", | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=503 yields red", | ||
"context": { | ||
"properties": {"customField": "16"} | ||
"properties": {"customField": "503"} | ||
}, | ||
"toggleName": "Feature.flexible.rollout.custom.stickiness_100", | ||
"expectedResult": { | ||
"name": "blue", | ||
"payload": { | ||
"type": "string", | ||
"value": "val1" | ||
}, | ||
"enabled": true | ||
} | ||
}, | ||
{ | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=198 yields red", | ||
"context": { | ||
"properties": {"customField": "198"} | ||
}, | ||
"toggleName": "Feature.flexible.rollout.custom.stickiness_100", | ||
"expectedResult": { | ||
"name": "red", | ||
@@ -165,5 +150,5 @@ "payload": { | ||
{ | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=43 yields green", | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=438 yields green", | ||
"context": { | ||
"properties": {"customField": "43"} | ||
"properties": {"customField": "438"} | ||
}, | ||
@@ -181,5 +166,5 @@ "toggleName": "Feature.flexible.rollout.custom.stickiness_100", | ||
{ | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=112 yields yellow", | ||
"description": "Feature.flexible.rollout.custom.stickiness_100 and customField=44 yields yellow", | ||
"context": { | ||
"properties": {"customField": "112"} | ||
"properties": {"customField": "44"} | ||
}, | ||
@@ -186,0 +171,0 @@ "toggleName": "Feature.flexible.rollout.custom.stickiness_100", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
165203
4840