UNPKG

@signatu/policy

Version:
35 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var __1 = require("../.."); describe('Fonticon', function () { var icon; beforeEach(function () { icon = new __1.FontIconContent('hello icon', 'my-css-class'); icon.ref = "https://foo.bar"; }); describe('serializes', function () { it('correctly toJSON()', function () { var iconJSON = icon.toJSON(); expect(iconJSON.contentType).toEqual(__1.ContentType.ICON); expect(iconJSON.type).toEqual(__1.ContentType.ICON); expect(iconJSON.title).toEqual('hello icon'); expect(iconJSON.cssClass).toEqual('my-css-class'); }); it('correctly with stringify()', function () { var s = JSON.stringify(icon); expect(s).toContain('"title":"hello icon"'); expect(s).toContain('"cssClass":"my-css-class"'); expect(s).toContain("\"contentType\":\"" + __1.ContentType.ICON + "\""); expect(s).toContain("\"ref\":\"" + icon.ref + "\""); }); }); describe('deserializes', function () { it('correctly', function () { var s = JSON.stringify(icon); var json = JSON.parse(s); var parsed = __1.FontIconContent.fromJSON(json); expect(icon).toEqual(parsed); }); }); }); //# sourceMappingURL=fontIcon.test.js.map