@bavard/agent-config
Advanced tools
Comparing version 0.0.61 to 0.0.62
@@ -135,2 +135,5 @@ "use strict"; | ||
this.graphPolicies.delete(name); | ||
if (name === this.activePolicyName) { | ||
this.activePolicyName = undefined; | ||
} | ||
return this; | ||
@@ -201,3 +204,7 @@ } | ||
} | ||
jsonObj.activePolicyName && config.setActivePolicyName(jsonObj.activePolicyName); | ||
if (jsonObj.activePolicyName) { | ||
if (config.graphPolicies.has(jsonObj.activePolicyName)) { | ||
config.setActivePolicyName(jsonObj.activePolicyName); | ||
} | ||
} | ||
return config; | ||
@@ -204,0 +211,0 @@ } |
{ | ||
"name": "@bavard/agent-config", | ||
"version": "0.0.61", | ||
"version": "0.0.62", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -161,2 +161,5 @@ import { BaseAgentAction } from './actions/agent/base-action'; | ||
this.graphPolicies.delete(name); | ||
if (name === this.activePolicyName) { | ||
this.activePolicyName = undefined; | ||
} | ||
return this; | ||
@@ -244,3 +247,7 @@ } | ||
jsonObj.activePolicyName && config.setActivePolicyName(jsonObj.activePolicyName); | ||
if (jsonObj.activePolicyName) { | ||
if (config.graphPolicies.has(jsonObj.activePolicyName)) { | ||
config.setActivePolicyName(jsonObj.activePolicyName); | ||
} | ||
} | ||
@@ -247,0 +254,0 @@ return config; |
@@ -237,8 +237,10 @@ import { assert } from 'chai'; | ||
config.addGraphPolicy(policy2); | ||
config.setActivePolicyName(policy2.policyName); | ||
config.deleteGraphPolicy(policy1.policyName); | ||
config.deleteGraphPolicy(policy2.policyName); | ||
assert.equal(config.getActiveGraphPolicy(), undefined); | ||
const policies = config.getGraphPolicies(); | ||
assert.equal(policies.length, 1); | ||
assert.deepEqual(policy2, policies[0]); | ||
assert.deepEqual(policy1, policies[0]); | ||
}); | ||
@@ -245,0 +247,0 @@ |
211325
5938