@codefresh-io/authenticated-entity
Advanced tools
Comparing version 2.9.0 to 2.10.0
@@ -340,12 +340,2 @@ 'use strict'; | ||
it('activeAccount should only contain the active account id', () => { | ||
const user = User.constructFromUserEntity(fakeUserData()); | ||
const activeAccount = { | ||
name: 'fake-account-name-1', | ||
id: 'fake-accountId-1', | ||
}; | ||
user.setActiveAccount(activeAccount.name, activeAccount.id); | ||
expect(user._entity.activeAccount).to.equal(activeAccount.id); | ||
}); | ||
it('should set active account when constructing entity from user encoding', () => { | ||
@@ -352,0 +342,0 @@ const user = User.constructFromUserEntity(fakeUserData()); |
@@ -59,12 +59,7 @@ const _ = require('lodash'); | ||
_.set(this, '_entity.activeAccount', id.toString()); | ||
_.set(this, '_entity.activeAccount', account); | ||
} | ||
getActiveAccount() { | ||
const activeAccountId = _.get(this, '_entity.activeAccount'); | ||
if (!activeAccountId) { | ||
return {}; | ||
} | ||
return this.getAccountById(activeAccountId) || {}; | ||
return _.get(this, '_entity.activeAccount', {}); | ||
} | ||
@@ -77,3 +72,3 @@ | ||
getAccountById(id) { | ||
return this._entity.accounts.find(a => a._id === id || a.id === id); | ||
return this._entity.accounts.find(a => a._id === id); | ||
} | ||
@@ -80,0 +75,0 @@ |
{ | ||
"name": "@codefresh-io/authenticated-entity", | ||
"version": "2.9.0", | ||
"version": "2.10.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
280112
1666