UNPKG

@helium/http

Version:

HTTP library for interacting with the Helium blockchain API

62 lines 2.35 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Client_1 = __importDefault(require("../../Client")); const Hotspot_1 = __importDefault(require("../Hotspot")); test('create Hotspot from HTTP response', () => { var _a, _b; const hotspot = new Hotspot_1.default(new Client_1.default(), { speculative_nonce: 2, lng: -123.1234567890, lat: 12.34567890123, timestamp_added: '2021-05-11T21:01:17.000000Z', status: { timestamp: '2021-07-13T05:31:11.562000Z', online: 'online', listen_addrs: [ '/ip4/12.345.678.901/tcp/57449', ], height: 123456, }, reward_scale: 1, owner: 'mock-owner', payer: 'mock-payer', nonce: 1, name: 'mock-name', location: 'mock-location', location_hex: 'mock-location-hex', last_poc_challenge: 123456, last_change_block: 123456, geocode: { short_street: 'mock-short-street', short_state: 'CA', short_country: 'US', short_city: 'mock-short-city', long_street: 'mock-long-street', long_state: 'California', long_country: 'United States', long_city: 'mock-long-city', city_id: 'mock-city-id', }, gain: 12, elevation: 0, mode: 'full', block_added: 123456, block: 123456, address: 'mock-address', }); expect(hotspot.address).toBe('mock-address'); expect(hotspot.owner).toBe('mock-owner'); expect(hotspot.payer).toBe('mock-payer'); expect(hotspot.speculativeNonce).toBe(2); expect(hotspot.nonce).toBe(1); expect(hotspot.rewardScale).toBe(1); expect((_a = hotspot.geocode) === null || _a === void 0 ? void 0 : _a.longCity).toBe('mock-long-city'); expect(hotspot.blockAdded).toBe(123456); expect(hotspot.locationHex).toBe('mock-location-hex'); expect(hotspot.mode).toBe('full'); expect((_b = hotspot.status) === null || _b === void 0 ? void 0 : _b.timestamp).toBe('2021-07-13T05:31:11.562000Z'); }); //# sourceMappingURL=Hotspot.spec.js.map