UNPKG

@ledgerhq/live-common

Version:
46 lines 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const types_1 = require("./types"); jest.mock("@ledgerhq/device-core", () => { return { isAppStorageInfo: jest.fn(() => true), }; }); describe("isAppStorageType", () => { it("should return true for valid AppStorageType", () => { const data = { appDataInfo: {}, appData: "MTA2IFJ1ZSBkdSBUZW1wbGUgNzUwMDMgUGFyaXM=", // 106 Rue du Temple 75003 Paris }; expect((0, types_1.isAppStorageType)(data)).toBe(true); }); it("should return false for missing appDataInfo", () => { const data = { // Missing appDataInfo property appData: "MTA2IFJ1ZSBkdSBUZW1wbGUgNzUwMDMgUGFyaXM=", }; expect((0, types_1.isAppStorageType)(data)).toBe(false); }); it("should return false for missing appData", () => { const data = { appDataInfo: {}, // Missing appData property }; expect((0, types_1.isAppStorageType)(data)).toBe(false); }); it("should return false for invalid appData type", () => { const data = { appDataInfo: {}, appData: 42, // Invalid appData }; expect((0, types_1.isAppStorageType)(data)).toBe(false); }); it("should return false for unknown data", () => { const data = { // Unknown data foo: "bar", }; expect((0, types_1.isAppStorageType)(data)).toBe(false); }); }); //# sourceMappingURL=types.test.js.map