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

d2l-lms-launch-darkly-feature-converter-plugin

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d2l-lms-launch-darkly-feature-converter-plugin - npm Package Compare versions

Comparing version 0.8.4 to 0.9.0

schemas/instance-boolean/v1_2.json

2

package.json
{
"name": "d2l-lms-launch-darkly-feature-converter-plugin",
"version": "0.8.4",
"version": "0.9.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -35,7 +35,11 @@ const _ = require( 'lodash' );

const on = (
targets.length > 0
|| rules.length > 0
);
const disabled = definition.disabled === true;
const on =
!disabled
&& (
targets.length > 0
|| rules.length > 0
);
return {

@@ -42,0 +46,0 @@ on,

@@ -19,2 +19,3 @@ const _ = require( 'lodash' );

const instanceBooleanSchemaV1_1 = require( '../schemas/instance-boolean/v1_1.json' );
const instanceBooleanSchemaV1_2 = require( '../schemas/instance-boolean/v1_2.json' );

@@ -67,3 +68,4 @@ const instanceMultivariateSchemaV1_0 = require( '../schemas/instance-multivariate/v1_0.json' );

instanceBooleanSchemaV1_0,
instanceBooleanSchemaV1_1
instanceBooleanSchemaV1_1,
instanceBooleanSchemaV1_2
] ),

@@ -70,0 +72,0 @@ booleanVariationMapper,

@@ -173,4 +173,137 @@ const _ = require( 'lodash' );

} );
const instanceBooleanSchemaV1_2 = 'http://schemas.dev.brightspace.com/feature-flags/instance-boolean/v1_2.json';
it( 'should disable', function() {
const converter = convertersMap[instanceBooleanSchemaV1_2];
assert( converter, 'converter should be constructed' );
const definition = {
$schema: instanceBooleanSchemaV1_2,
name: 'Switch',
description: 'Simple on/off switch',
tags: [
'mocha',
'test'
],
variations: {
true: {
name: 'On',
description: 'Turns the switch on'
},
false: {
name: 'Off',
description: 'Turns the switch off'
}
},
environments: {
production: {
disabled: true,
defaultVariation: 'false',
targets: [
{
instanceIds: [
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
],
variation: 'true'
},
{
instanceIds: [
'bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'
],
variation: 'false'
}
]
},
development: {
defaultVariation: 'true',
rules: [
{
versions: {
start: '10.8.4.0'
},
variation: 'false'
}
]
}
}
};
const expected = {
name: 'Switch',
kind: 'boolean',
description: 'Simple on/off switch',
includeInSnippet: false,
variations: [
{
name: 'On',
description: 'Turns the switch on',
value: true
},
{
name: 'Off',
description: 'Turns the switch off',
value: false
}
],
temporary: true,
tags: [
'lms-generated-flag',
'lms-instance-flag',
'mocha',
'test'
],
environments: {
production: {
on: false,
targets: [
{
values: [
'instance:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
],
variation: 0
},
{
values: [
'instance:bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb'
],
variation: 1
}
],
rules: [],
fallthrough: {
variation: 1
},
offVariation: 1,
},
test: {
on: true,
targets: [],
rules: [
{
variation: 1,
clauses: [
{
attribute: 'productVersion',
op: 'greaterThanOrEqual',
values: [
10080400000
],
negate: false
}
]
}
],
fallthrough: {
variation: 0
},
offVariation: 0,
}
}
};
testConverter( converter, definition, expected );
} );
} );
} );

@@ -150,3 +150,39 @@ const assert = require( 'chai' ).assert;

} );
it( 'should set environment off when disabled', function() {
const definition = {
disabled: true,
defaultVariation: 'on',
targets: [
{
instances: [
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'
],
variation: 'on'
}
]
};
const expected = {
on: false,
targets: [
{
values: [ 'instance:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' ],
variation: 0
}
],
rules: [],
fallthrough: {
variation: 0
},
offVariation: 0
};
assert.deepEqual(
mapper.mapEnvironment( definition, variationIndexMap ),
expected
);
} );
} );
} );
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