@yoroi/portfolio
Version:
The Portfolio package of Yoroi SDK
31 lines • 1.3 kB
JavaScript
import { Portfolio } from '@yoroi/types';
import { isTokenNature, parseTokenNature } from './token-nature';
describe('isTokenNature', () => {
it('should return true for valid token nature', () => {
const validTokenNature = Portfolio.Token.Nature.Primary;
expect(isTokenNature(validTokenNature)).toBe(true);
});
it('should return false for invalid token nature', () => {
const invalidTokenNature = 'InvalidTokenNature';
expect(isTokenNature(invalidTokenNature)).toBe(false);
});
it('should return false for undefined', () => {
const undefinedTokenNature = undefined;
expect(isTokenNature(undefinedTokenNature)).toBe(false);
});
});
describe('parseTokenNature', () => {
it('should return valid token nature', () => {
const validTokenNature = Portfolio.Token.Nature.Primary;
expect(parseTokenNature(validTokenNature)).toBe(validTokenNature);
});
it('should return undefined for invalid token nature', () => {
const invalidTokenNature = 'InvalidTokenNature';
expect(parseTokenNature(invalidTokenNature)).toBeUndefined();
});
it('should return undefined for undefined', () => {
const undefinedTokenNature = undefined;
expect(parseTokenNature(undefinedTokenNature)).toBeUndefined();
});
});
//# sourceMappingURL=token-nature.test.js.map