Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/accounts/accounts.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,26 @@ describe('AccountsService', () => {

expect(result).toStrictEqual(fakeResult);
});

it('should return null for multiSigDetails when account has no multiSig', async () => {
const mockAccount = new MockAccount();
const mockIdentity = new MockIdentity();

const findOneSpy = jest.spyOn(service, 'findOne');
findOneSpy.mockResolvedValue(mockAccount as unknown as Account);

mockAccount.getIdentity.mockResolvedValue(mockIdentity);
mockAccount.getMultiSig.mockResolvedValue(null);

const result = await service.getDetails('address');

const fakeResult = {
identity: mockIdentity,
multiSigDetails: null,
};

expect(result).toStrictEqual(fakeResult);
});
});

describe('fetchOffChainReceipts', () => {
Expand Down
26 changes: 26 additions & 0 deletions src/assets/assets.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,32 @@ describe('AssetsController', () => {
});
});

describe('getTransferRestrictionValues', () => {
it('should return transfer restriction values', async () => {
const mockTransferRestrictionValues = [
{
type: TransferRestrictionType.Count,
value: new BigNumber(100),
},
{
type: TransferRestrictionType.Percentage,
value: new BigNumber(50),
},
];

mockAssetsService.getTransferRestrictionValues.mockResolvedValue(
mockTransferRestrictionValues as never
);

const result = await controller.getTransferRestrictionValues({ asset: assetId });

expect(mockAssetsService.getTransferRestrictionValues).toHaveBeenCalledWith(assetId);
expect(result).toHaveLength(2);
expect(result[0]).toBeDefined();
expect(result[1]).toBeDefined();
});
});

describe('addTransferRestrictions', () => {
it('should call the service and return the results', async () => {
mockAssetsService.addTransferRestrictions.mockResolvedValue(txResult);
Expand Down
Loading