Skip to content

Commit 4fab3c2

Browse files
0xVoronovportuu3
andauthored
[Job Launcher] - Proper testing and documentation updates (#664)
* Added logic for rate processing * Updated tests * Updated transaction amount converting * Updated get balance method, added unsupported token test case, updated tests * Fixed comparison of balance and fund amount and unit tests * Added recipient validation and updated unit tests (#669) * Removed dublicate return * Updated get rate method to work with tokens and cirrencies * Resolved conflicts * Updated payment service * Updated fund amount calculation * suggest fee management in job launcher (#692) * Fixed test cases * fix payment amount saved * Updated unit tests * Updated units * Updated auth service test * Reverted updates for unit tests * Removed final amount count dublicates --------- Co-authored-by: portuu3 <[email protected]> Co-authored-by: portuu3 <[email protected]>
1 parent 691e055 commit 4fab3c2

File tree

10 files changed

+400
-266
lines changed

10 files changed

+400
-266
lines changed

packages/apps/job-launcher/server/src/common/constants/errors.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ export enum ErrorPayment {
5555
CustomerNotFound = 'Customer not found',
5656
CustomerNotCreated = 'Customer not created',
5757
IncorrectAmount = 'Incorrect amount',
58-
TransactionHashAlreadyExists = 'transaction hash already exists',
58+
TransactionHashAlreadyExists = 'Transaction hash already exists',
5959
TransactionNotFoundByHash = 'Transaction not found by hash',
6060
InvalidTransactionData = 'Invalid transaction data',
6161
TransactionHasNotEnoughAmountOfConfirmations = 'Transaction has not enough amount of confirmations',
6262
UnsupportedToken = 'Unsupported token',
63+
InvalidRecipient = 'Invalid recipient',
6364
}
6465

6566
/**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export const CoingeckoTokenId: ICoingeckoTokenId = {
2-
'hmt': 'human-protocol',
3-
}
2+
hmt: 'human-protocol',
3+
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
interface ICoingeckoTokenId {
2-
[key: string]: string;
3-
}
2+
[key: string]: string;
3+
}

packages/apps/job-launcher/server/src/common/test/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export const MOCK_REQUESTER_TITLE = 'Mock job title';
22
export const MOCK_REQUESTER_DESCRIPTION = 'Mock job description';
33
export const MOCK_FORTUNES_REQUIRED = 5;
44
export const MOCK_CHAIN_ID = 1;
5-
export const MOCK_ADDRESS = '0x1234567890abcdef';
5+
export const MOCK_ADDRESS = '0x1234567890123456789012345678901234567892';
66
export const MOCK_FILE_URL = 'mockedFileUrl';
77
export const MOCK_FILE_HASH = 'mockedFileHash';
88
export const MOCK_FILE_KEY = 'manifest.json';

packages/apps/job-launcher/server/src/modules/auth/auth.service.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ export class AuthService {
102102
const refreshToken = v4();
103103
const date = new Date();
104104

105-
const accessTokenExpiresIn = ~~this.configService.get<number>(ConfigNames.JWT_ACCESS_TOKEN_EXPIRES_IN)!;
106-
const refreshTokenExpiresIn = ~~this.configService.get<number>(ConfigNames.JWT_REFRESH_TOKEN_EXPIRES_IN)!;
105+
const accessTokenExpiresIn = ~~this.configService.get<number>(
106+
ConfigNames.JWT_ACCESS_TOKEN_EXPIRES_IN,
107+
)!;
108+
const refreshTokenExpiresIn = ~~this.configService.get<number>(
109+
ConfigNames.JWT_REFRESH_TOKEN_EXPIRES_IN,
110+
)!;
107111

108112
await this.logout({ userId: userEntity.id });
109113

packages/apps/job-launcher/server/src/modules/job/job.dto.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ export class FortuneManifestDto {
146146
@IsString()
147147
requesterDescription: string;
148148

149-
@IsString()
150-
fee: string;
151-
152149
@IsString()
153150
fundAmount: string;
154151

@@ -174,9 +171,6 @@ export class ImageLabelBinaryManifestDto {
174171
@IsPositive()
175172
requesterAccuracyTarget: number;
176173

177-
@IsString()
178-
fee: string;
179-
180174
@IsString()
181175
fundAmount: string;
182176

0 commit comments

Comments
 (0)