decentraland-ui
Version:
Decentraland's UI components and styles
23 lines (22 loc) • 961 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var utils_1 = require("./utils");
describe('isValid', function () {
it('should return false when address is undefined', function () {
expect((0, utils_1.isValid)(undefined)).toBe(false);
});
it("should return false when address doesn't match regex", function () {
expect((0, utils_1.isValid)('0x')).toBe(false);
});
it('should return true when address matches regex', function () {
expect((0, utils_1.isValid)('0x89805E5f0698Cb4dB57f0E389f2a75259f78CC22')).toBe(true);
});
});
describe('shorten', function () {
it('should return empty string when address is not defined', function () {
expect((0, utils_1.shorten)(undefined)).toBe('');
});
it('should return first and last 5 items', function () {
expect((0, utils_1.shorten)('0x89805E5f0698Cb4dB57f0E389f2a75259f78CC22')).toBe('0x8980...8CC22');
});
});