Skip to content

Commit c1f030c

Browse files
Merge pull request #364 from LeKer29/fix/incorrect-transaction-mapping
[FIX] use account's type to map transactions
2 parents f535597 + e2ac293 commit c1f030c

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/hooks/services/hooks.service.spec.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { CONFIG, ConfigModule } from '../../config/config.module';
3333
import { AggregatorLinkRequiredDTO } from '../dto/aggregator-link-required.dto';
3434
import { EventDTO } from '../dto/event.dto';
3535
import { HooksService } from './hooks.service';
36+
import { BridgeAccountType } from '../../aggregator/interfaces/bridge.interface';
3637

3738
describe('HooksService', () => {
3839
let hooksService: HooksService;
@@ -205,9 +206,10 @@ describe('HooksService', () => {
205206
expires_at: '323423423423',
206207
user: { email: 'test@test.com', uuid: 'rrr' },
207208
});
208-
const accountSpy = jest
209-
.spyOn(aggregatorService, 'getAccounts')
210-
.mockResolvedValue([mockAccount, { ...mockAccount, id: 0 }]);
209+
const accountSpy = jest.spyOn(aggregatorService, 'getAccounts').mockResolvedValue([
210+
{ ...mockAccount, type: BridgeAccountType.CHECKING },
211+
{ ...mockAccount, id: 0 },
212+
]);
211213
const userInfoSpy = jest
212214
.spyOn(aggregatorService, 'getUserPersonalInformation')
213215
.mockResolvedValue(mockPersonalInformation);
@@ -265,7 +267,7 @@ describe('HooksService', () => {
265267
name: ' DUPONT',
266268
},
267269
],
268-
type: 'CREDIT_CARD',
270+
type: 'CHECKING',
269271
usage: 'PERSONAL',
270272
transactions: [
271273
{
@@ -441,8 +443,8 @@ describe('HooksService', () => {
441443
amount: 30,
442444
currency: 'USD',
443445
dates: {
444-
bookedAt: undefined,
445-
debitedAt: '2019-04-06T13:53:12.000Z',
446+
debitedAt: undefined,
447+
bookedAt: '2019-04-06T13:53:12.000Z',
446448
},
447449
description: 'mockRawDescription',
448450
isComing: false,
@@ -455,8 +457,8 @@ describe('HooksService', () => {
455457
amount: 30,
456458
currency: 'USD',
457459
dates: {
458-
bookedAt: undefined,
459-
debitedAt: date,
460+
debitedAt: undefined,
461+
bookedAt: date,
460462
},
461463
description: 'mockRawDescription',
462464
isComing: false,

src/hooks/services/hooks.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export class HooksService {
292292
),
293293
accessToken,
294294
this.aggregator,
295-
AccountType.CHECKING,
295+
account.type,
296296
saConfig,
297297
);
298298
if (!isEmpty(algoanTransactions)) {

0 commit comments

Comments
 (0)