UNPKG

@0xcert/utils

Version:

General utility module with common helper functions.

25 lines 1.41 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const spec_1 = require("@hayspec/spec"); const path = require("path"); const fetch_1 = require("../../methods/fetch"); const spec = new spec_1.Spec(); spec.test('downloads a remote file', (ctx) => __awaiter(void 0, void 0, void 0, function* () { const res = yield fetch_1.fetchJson('https://docs.0xcert.org/xcert-mock.json'); ctx.true(!!res.XcertMock); })); spec.test('reads a local file', (ctx) => __awaiter(void 0, void 0, void 0, function* () { const res = yield fetch_1.fetchJson(path.join(__dirname, '..', 'mocks', 'xcert-mock.json')); ctx.true(!!res.XcertMock); })); exports.default = spec; //# sourceMappingURL=fetch.test.js.map