|
|
|
@ -3082,20 +3082,6 @@ describe('redactAttributes', () => { |
|
|
|
feeInBaseCurrency: 18.2, |
|
|
|
id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b', |
|
|
|
quantity: 50, |
|
|
|
// The relation of the database is part of the response next to the
|
|
|
|
// asset profile
|
|
|
|
SymbolProfile: { |
|
|
|
comment: 'Reviewed by the administrator', |
|
|
|
name: 'Apple Inc', |
|
|
|
scraperConfiguration: { |
|
|
|
headers: { Authorization: 'Bearer TOKEN' }, |
|
|
|
mode: 'lazy', |
|
|
|
selector: '.price', |
|
|
|
url: 'https://example.org/get_price' |
|
|
|
}, |
|
|
|
symbol: 'AAPL', |
|
|
|
symbolMapping: { YAHOO: 'AAPL' } |
|
|
|
}, |
|
|
|
type: 'BUY', |
|
|
|
unitPrice: 220.79, |
|
|
|
value: 11039.5, |
|
|
|
@ -3125,6 +3111,49 @@ describe('redactAttributes', () => { |
|
|
|
feeInBaseCurrency: null, |
|
|
|
id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b', |
|
|
|
quantity: null, |
|
|
|
type: 'BUY', |
|
|
|
// A price per unit stays visible, like the average price and the market
|
|
|
|
// price of a holding
|
|
|
|
unitPrice: 220.79, |
|
|
|
value: null, |
|
|
|
valueInBaseCurrency: null |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// The endpoint POST api/v1/activities returns a row of the database with the
|
|
|
|
// relation to the symbol profile
|
|
|
|
it('should redact an activity with the relation to the symbol profile', () => { |
|
|
|
expect( |
|
|
|
redactPaths({ |
|
|
|
object: { |
|
|
|
comment: 'Bought on a dip', |
|
|
|
currency: 'USD', |
|
|
|
fee: 19.9, |
|
|
|
id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b', |
|
|
|
quantity: 50, |
|
|
|
SymbolProfile: { |
|
|
|
comment: 'Reviewed by the administrator', |
|
|
|
name: 'Apple Inc', |
|
|
|
scraperConfiguration: { |
|
|
|
headers: { Authorization: 'Bearer TOKEN' }, |
|
|
|
mode: 'lazy', |
|
|
|
selector: '.price', |
|
|
|
url: 'https://example.org/get_price' |
|
|
|
}, |
|
|
|
symbol: 'AAPL', |
|
|
|
symbolMapping: { YAHOO: 'AAPL' } |
|
|
|
}, |
|
|
|
type: 'BUY', |
|
|
|
unitPrice: 220.79 |
|
|
|
}, |
|
|
|
paths: DEFAULT_REDACTED_PATHS |
|
|
|
}) |
|
|
|
).toStrictEqual({ |
|
|
|
comment: null, |
|
|
|
currency: 'USD', |
|
|
|
fee: null, |
|
|
|
id: '8c623328-6035-4b5f-b6d5-702cc1c9c56b', |
|
|
|
quantity: null, |
|
|
|
SymbolProfile: { |
|
|
|
comment: null, |
|
|
|
name: 'Apple Inc', |
|
|
|
@ -3133,15 +3162,12 @@ describe('redactAttributes', () => { |
|
|
|
symbolMapping: null |
|
|
|
}, |
|
|
|
type: 'BUY', |
|
|
|
// A price per unit stays visible, like the average price and the market
|
|
|
|
// price of a holding
|
|
|
|
unitPrice: 220.79, |
|
|
|
value: null, |
|
|
|
valueInBaseCurrency: null |
|
|
|
unitPrice: 220.79 |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// The write endpoints return a row of the database, which has no relation
|
|
|
|
// The endpoints PUT and DELETE api/v1/activities/:id return a row of the
|
|
|
|
// database without the relations
|
|
|
|
it('should redact an activity without the relations', () => { |
|
|
|
expect( |
|
|
|
redactPaths({ |
|
|
|
|