Skip to content

Commit 5f07bc1

Browse files
test: 💍 add more tests
1 parent ba393a7 commit 5f07bc1

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/api/entities/Asset/NonFungible/NftCollection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function issueNftTransformer([nft]: Nft[]): Nft {
6262
if (!nft) {
6363
throw new PolymeshError({
6464
code: ErrorCode.DataUnavailable,
65-
message: 'Expected at least one nft',
65+
message: 'Expected at least one Nft',
6666
});
6767
}
6868
return nft;

src/api/entities/Asset/__tests__/NonFungible/NftCollection.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,4 +741,20 @@ describe('NftCollection class', () => {
741741
expect(nftCollection.toHuman()).toBe('12341234-1234-1234-1234123412341234');
742742
});
743743
});
744+
745+
describe('issueNftTransformer', () => {
746+
it('should return a single Nft', () => {
747+
const id = new BigNumber(1);
748+
const assetId = '12341234-1234-1234-1234-123412341234';
749+
750+
const result = issueNftTransformer([entityMockUtils.getNftInstance({ id, assetId })]);
751+
752+
expect(result.id).toEqual(id);
753+
expect(result.collection.id).toBe(assetId);
754+
});
755+
756+
it('should throw if no Nft is provided', () => {
757+
expect(() => issueNftTransformer([])).toThrow('Expected at least one Nft');
758+
});
759+
});
744760
});

0 commit comments

Comments
 (0)