Skip to content

Commit

Permalink
Add DB_MAX_SAFE_INTEGER constant
Browse files Browse the repository at this point in the history
  • Loading branch information
hectorgomezv committed Jul 26, 2024
1 parent b4f1447 commit a54ba29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/domain/accounts/entities/__tests__/account.builder.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { Builder, IBuilder } from '@/__tests__/builder';
import { Account } from '@/domain/accounts/entities/account.entity';
import { DB_MAX_SAFE_INTEGER } from '@/domain/common/constants';
import { faker } from '@faker-js/faker';
import { getAddress } from 'viem';

export function accountBuilder(): IBuilder<Account> {
return new Builder<Account>()
.with('id', faker.number.int({ max: 1_000_000 }))
.with('group_id', faker.number.int({ max: 1_000_000 }))
.with('id', faker.number.int({ max: DB_MAX_SAFE_INTEGER }))
.with('group_id', faker.number.int({ max: DB_MAX_SAFE_INTEGER }))
.with('address', getAddress(faker.finance.ethereumAddress()))
.with('created_at', faker.date.recent())
.with('updated_at', faker.date.recent());
Expand Down
5 changes: 5 additions & 0 deletions src/domain/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* The maximum safe integer for the database.
* This is an arbitrary value
*/
export const DB_MAX_SAFE_INTEGER = Math.pow(2, 31) - 1;

0 comments on commit a54ba29

Please sign in to comment.