|
|
@ -1,8 +1,13 @@ |
|
|
|
|
|
import { |
|
|
|
|
|
TAG_ID_EMERGENCY_FUND, |
|
|
|
|
|
TAG_ID_EXCLUDE_FROM_ANALYSIS |
|
|
|
|
|
} from '@ghostfolio/common/config'; |
|
|
import { |
|
|
import { |
|
|
extractNumberFromString, |
|
|
extractNumberFromString, |
|
|
getNumberFormatGroup, |
|
|
getNumberFormatGroup, |
|
|
getStringOrNull, |
|
|
getStringOrNull, |
|
|
getStringOrUndefined, |
|
|
getStringOrUndefined, |
|
|
|
|
|
isAccountExcluded, |
|
|
isCurrency, |
|
|
isCurrency, |
|
|
isCurrencySymbol |
|
|
isCurrencySymbol |
|
|
} from '@ghostfolio/common/helper'; |
|
|
} from '@ghostfolio/common/helper'; |
|
|
@ -197,6 +202,28 @@ describe('Helper', () => { |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('Is account excluded', () => { |
|
|
|
|
|
it('Account with Exclude from Analysis tag', () => { |
|
|
|
|
|
expect( |
|
|
|
|
|
isAccountExcluded({ tags: [{ id: TAG_ID_EXCLUDE_FROM_ANALYSIS }] }) |
|
|
|
|
|
).toEqual(true); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Account with another tag', () => { |
|
|
|
|
|
expect( |
|
|
|
|
|
isAccountExcluded({ tags: [{ id: TAG_ID_EMERGENCY_FUND }] }) |
|
|
|
|
|
).toEqual(false); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Account without tags', () => { |
|
|
|
|
|
expect(isAccountExcluded({ tags: [] })).toEqual(false); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('Undefined account', () => { |
|
|
|
|
|
expect(isAccountExcluded(undefined)).toEqual(false); |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
describe('Is currency', () => { |
|
|
describe('Is currency', () => { |
|
|
it('ISO 4217 currency code', () => { |
|
|
it('ISO 4217 currency code', () => { |
|
|
expect(isCurrency('USD')).toEqual(true); |
|
|
expect(isCurrency('USD')).toEqual(true); |
|
|
|