UNPKG

@kintone/customize-uploader

Version:
48 lines 2.01 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const assert_1 = __importDefault(require("assert")); const util_1 = require("../util"); describe("util", () => { describe("isUrlString", () => { it("should return true if the string is URL", () => { (0, assert_1.default)((0, util_1.isUrlString)("https://example.com") === true); (0, assert_1.default)((0, util_1.isUrlString)("http://localhost:8000") === true); }); it("should return false if the string is not URL", () => { (0, assert_1.default)((0, util_1.isUrlString)("example.com") === false); (0, assert_1.default)((0, util_1.isUrlString)("js/desktop.js") === false); }); }); describe("wait", () => { it("should wait the specific ms", () => { const start = Date.now(); return (0, util_1.wait)(100).then(() => { (0, assert_1.default)(Date.now() >= start + 90); }); }); }); describe("parseProxy", () => { it("should return proxy object", () => { const host = "localhost"; const port = 8080; const result = (0, util_1.parseProxy)(`http://${host}:${port}`); expect(result).toStrictEqual({ host, port, auth: undefined }); }); it("should return proxy object with username and password", () => { const host = "localhost"; const port = 8080; const username = "USERNAME"; const password = "PASSWORD"; const result = (0, util_1.parseProxy)(`http://${username}:${password}@${host}:${port}`); expect(result).toStrictEqual({ host, port, auth: { username, password }, }); }); }); }); //# sourceMappingURL=util.test.js.map