Skip to content

Commit

Permalink
feat: configure test projects tp-6610 time:4
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendakh committed Sep 7, 2021
1 parent 466bc17 commit 56a5e15
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/algoan/dto/service-account.objects.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ export const serviceAccountConfigMock: ClientConfig = {
pricing: ClientPricing.STANDARD,
market: 'FR',
locale: 'fr_FR',
realDataTest: true,
};
5 changes: 4 additions & 1 deletion src/algoan/dto/service-account.objects.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IsEnum, IsString } from 'class-validator';
import { IsBoolean, IsEnum, IsString } from 'class-validator';
import { ClientPricing } from './service-account.enums';

/**
Expand All @@ -19,4 +19,7 @@ export class ClientConfig {

@IsString()
public locale: string;

@IsBoolean()
public realDataTest: boolean;
}
4 changes: 2 additions & 2 deletions src/hooks/services/hooks.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import { TINK_LINK_ACTOR_CLIENT_ID } from '../../tink/contstants/tink.constants'
import { bankDetailsRequiredMock } from '../dto/bank-details-required-payload.dto.mock';
import { mapTinkDataToAlgoanAnalysis } from '../mappers/analysis.mapper';
import { AggregationDetailsMode } from '../../algoan/dto/customer.enums';
import { HooksService } from './hooks.service';
import { AnalysisStatus, ErrorCodes } from '../../algoan/dto/analysis.enum';
import { HooksService } from './hooks.service';

describe('HookService', () => {
let hookService: HooksService;
Expand Down Expand Up @@ -297,7 +297,7 @@ describe('HookService', () => {
market: serviceAccountConfigMock.market,
locale: serviceAccountConfigMock.locale,
scope: 'accounts:read,transactions:read,credentials:read',
test: config.tink.test,
test: serviceAccountConfigMock.realDataTest,
authorization_code: createAuthorizationObjectMock.code,
iframe: true,
});
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/services/hooks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export class HooksService {

// Get user information and client config
const customer: Customer = await this.algoanCustomerService.getCustomerById(payload.customerId);

// Ignore query params since Tink does not accept variables
const callbackUrl: string | undefined = customer.aggregationDetails.callbackUrl?.split(/[?#]/)[0];
const clientConfig: ClientConfig | undefined = this.serviceAccount.config as ClientConfig | undefined;
Expand Down Expand Up @@ -143,7 +144,7 @@ export class HooksService {
redirect_uri: callbackUrl,
market: clientConfig.market,
locale: clientConfig.locale,
test: this.config.tink.test ?? false,
test: clientConfig.realDataTest ?? false,
scope: [
'accounts:read', // To list account: https://docs.tink.com/api#account-list-accounts-required-scopes-
'transactions:read', // To list transactions: https://docs.tink.com/api#search-query-transactions-required-scopes-
Expand Down
2 changes: 2 additions & 0 deletions test/hooks.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable arrow-body-style */
import { INestApplication, HttpStatus } from '@nestjs/common';
import * as nock from 'nock';
import { AggregationDetailsMode } from '../src/algoan/dto/customer.enums';
import * as request from 'supertest';
import { buildFakeApp, fakeAlgoanBaseUrl } from './utils/app';
import { fakeAPI } from './utils/fake-server';
Expand Down Expand Up @@ -78,6 +79,7 @@ describe('HooksController (e2e)', () => {
customIdentifier: 'client_unique_identifier',
aggregationDetails: {
callbackUrl: `${fakeAlgoanBaseUrl}/callback`,
mode: AggregationDetailsMode.redirect,
},
},
path: '/v2/customers/customerId',
Expand Down
1 change: 1 addition & 0 deletions test/utils/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const buildFakeApp = async (): Promise<INestApplication> => {
pricing: 'STANDARD',
market: 'BE',
locale: 'en_US',
realDataTest: true,
},
},
],
Expand Down

0 comments on commit 56a5e15

Please sign in to comment.