Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@unleash/client-specification

Package Overview
Dependencies
Maintainers
4
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unleash/client-specification - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

renovate.json

14

index.js

@@ -9,9 +9,9 @@ const Joi = require('joi');

const testCase = require(`./specifications/${name}`);
Joi.validate(testCase, testCaseSchema, err => {
if (err) {
console.error(`${name} ${chalk.red('is not valid')}. \n`, err);
} else {
console.log(`${name} ${chalk.green('is valid')}`);
}
});
const { error, value } = testCaseSchema.validate(testCase)
if (error) {
console.error(`${name} ${chalk.red('is not valid')}. \n`, error);
} else {
console.log(`${name} ${chalk.green('is valid')}`);
}
});
{
"name": "@unleash/client-specification",
"version": "4.0.0",
"version": "4.1.0",
"description": "A collection of test specifications to guide client implementations in various langugages",
"scripts": {
"test": "node index"
"test": "node index",
"preci": "rm -fr node_modules",
"ci": "yarn install --frozen-lockfile"
},

@@ -19,6 +21,6 @@ "repository": {

"devDependencies": {
"chalk": "^2.4.1",
"joi": "^13.4.0",
"murmurhash3js": "^3.0.1"
"chalk": "4.1.2",
"joi": "17.6.0",
"murmurhash3js": "3.0.1"
}
}
![Build](https://github.com/Unleash/client-specification/workflows/Build/badge.svg)
# Unleash Client Specifications
Implementing a Unleash client for a specific platfrom can be a challenge in it's own. And we want the clients to follow specific platform and language conventions, but at the same time we want the clients to adhere to the unleash contract, and give predictable results across platforms.
Implementing a Unleash client for a specific platfrom can be a challenge in it's own. And we want the clients to follow specific platform and language conventions, but at the same time we want the clients to adhere to the unleash contract, and give predictable results across platforms.
This project tries to define the expected results of certain predefined set of feature toggles, using the  [built-in activation strategies](https://github.com/Unleash/unleash/blob/master/docs/activation-strategies.md) and with a given [unleash context](https://github.com/Unleash/unleash/blob/master/docs/unleash-context.md).
This project tries to define the expected results of certain predefined set of feature toggles, using the  [built-in activation strategies](https://github.com/Unleash/unleash/blob/main/docs/activation-strategies.md) and with a given [unleash context](https://github.com/Unleash/unleash/blob/main/docs/unleash-context.md).
### Test structure
All the tests are located in the [/specifications](specifications) folder.
All the tests are located in the [/specifications](specifications) folder.
There is an entry point for all the tests, which will include a list of all the defined specification test cases, [/specifications/index.json](https://github.com/Unleash/client-specification/blob/master/specifications/index.json). Clients should parse this entry-point in order to discover all specifications to run.
There is an entry point for all the tests, which will include a list of all the defined specification test cases, [/specifications/index.json](https://github.com/Unleash/client-specification/blob/main/specifications/index.json). Clients should parse this entry-point in order to discover all specifications to run.

@@ -63,3 +63,3 @@ ```json

}
```
```

@@ -69,12 +69,12 @@ Fields description:

- **name** - The name of the specification
- **state** - The list of toggles comming from the unleash-server. Would be the same response as the client will see when requesting `http://unleash-apu/client/features`. The state will be used for all test cases in this specification.
- **tests** - The list of `isEnabled` tests cases to run.
- **description** - Describes what this test case is testing. Suitable to output as the error message if the test case fails.
- **context** - The [unleash context](https://github.com/Unleash/unleash/blob/master/docs/unleash-context.md) the client should setup.
- **toggleName** - The toggle name to send in to the `isEnabled` call in this test case.
- **expectedResult** - The expected result of the `isEnabled` call with the given `toggleName`.
- **variantTests** - The list of `getVariant` tests cases to run.
- **description** - Describes what this test case is testing. Suitable to output as the error message if the test case fails.
- **context** - The [unleash context](https://github.com/Unleash/unleash/blob/master/docs/unleash-context.md) the client should setup.
- **toggleName** - The toggle name to send in to the `isEnabled` call in this test case.
- **expectedResult** - The expected result of the `getVariant` call with the given `toggleName`.
- **state** - The list of toggles coming from the unleash-server. Would be the same response as the client will see when requesting `http://unleash-api/client/features`. The state will be used for all test cases in this specification.
- **tests** - The list of `isEnabled` tests cases to run.
- **description** - Describes what this test case is testing. Suitable to output as the error message if the test case fails.
- **context** - The [unleash context](https://github.com/Unleash/unleash/blob/main/docs/unleash-context.md) the client should setup.
- **toggleName** - The toggle name to send in to the `isEnabled` call in this test case.
- **expectedResult** - The expected result of the `isEnabled` call with the given `toggleName`.
- **variantTests** - The list of `getVariant` tests cases to run.
- **description** - Describes what this test case is testing. Suitable to output as the error message if the test case fails.
- **context** - The [unleash context](https://github.com/Unleash/unleash/blob/main/docs/unleash-context.md) the client should setup.
- **toggleName** - The toggle name to send in to the `isEnabled` call in this test case.
- **expectedResult** - The expected result of the `getVariant` call with the given `toggleName`.

@@ -6,4 +6,5 @@ const Joi = require('joi');

sessionId: Joi.string(),
remoteAddress: Joi.string(),
environment: Joi.string(),
remoteAddress: Joi.string().optional(),
currentTime: Joi.string().optional(),
environment: Joi.string().optional(),
appName: Joi.string(),

@@ -10,0 +11,0 @@ properties: Joi.object().pattern(/\w+/, Joi.string()),

@@ -20,3 +20,6 @@ const Joi = require('joi');

operator: Joi.string().required(),
values: Joi.array().items(Joi.string())
values: Joi.array().items(Joi.string()),
caseInsensitive: Joi.bool().optional(),
inverted: Joi.bool().optional(),
value: Joi.string().optional()
}).optional()

@@ -23,0 +26,0 @@ ),

@@ -13,3 +13,5 @@ [

"11-strategy-constraints-edge-cases.json",
"12-custom-stickiness.json"
"12-custom-stickiness.json",
"13-constraint-operators.json",
"14-constraint-semver-operators.json"
]

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc