Skip to content

Commit

Permalink
test: 💍 fix leg-validations test
Browse files Browse the repository at this point in the history
  • Loading branch information
polymath-eric committed Nov 7, 2023
1 parent eb9ac00 commit a7bd03b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/settlements/dto/leg-validation-params.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ export class LegValidationParamsDto {
@ValidateIf(({ nfts }) => !nfts)
@IsBigNumber()
@ToBigNumber()
readonly amount: BigNumber;
readonly amount?: BigNumber;

@ApiPropertyOptional({
description: 'The NFT IDs to be transferred for the collection',
type: 'string',
isArray: true,
example: ['1000'],
example: ['1'],
})
@ValidateIf(({ amount }) => !amount)
@IsBigNumber()
@ToBigNumber()
readonly nfts: BigNumber[];
readonly nfts?: BigNumber[];

@ApiProperty({
description: 'DID of the sender',
Expand Down
2 changes: 1 addition & 1 deletion src/settlements/settlements.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ describe('SettlementsService', () => {
const mockAsset = new MockAsset();
mockAsset.settlements.canTransfer.mockResolvedValue(mockTransferBreakdown);

mockAssetsService.findFungible.mockResolvedValue(mockAsset);
mockAssetsService.findOne.mockResolvedValue(mockAsset);

const result = await service.canTransfer(
new PortfolioDto({ did: 'fromDid', id: new BigNumber(1) }).toPortfolioLike(),
Expand Down
6 changes: 4 additions & 2 deletions src/settlements/settlements.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,12 @@ export class SettlementsService {
from: PortfolioLike,
to: PortfolioLike,
ticker: string,
amount: BigNumber,
nfts: BigNumber[]
transferAmount?: BigNumber,
transferNfts?: BigNumber[]
): Promise<TransferBreakdown> {
const assetDetails = await this.assetsService.findOne(ticker);
const amount = transferAmount ?? new BigNumber(0);
const nfts = transferNfts ?? [];
return assetDetails.settlements.canTransfer({ from, to, amount, nfts });
}

Expand Down

0 comments on commit a7bd03b

Please sign in to comment.