@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
41 lines • 1.95 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const HostServiceEndpoint_1 = require("../../src/serviceEndpoints/HostServiceEndpoint");
const context = 'test.schema.identity.foundation/hub';
const location = 'https://test-hub.com';
describe('HostServiceEndpoint', () => {
const mockServiceEndpoint = {
locations: [
location
],
'@context': context,
'@type': 'HostServiceEndpoint'
};
let mockServiceEndpointStr;
let endpoint;
beforeAll(() => {
endpoint = new HostServiceEndpoint_1.default(context, [location]);
mockServiceEndpointStr = JSON.stringify(mockServiceEndpoint);
});
it('should create a new HostServiceEndpoint object', () => {
expect(endpoint).toBeDefined();
expect(endpoint instanceof HostServiceEndpoint_1.default).toBeTruthy();
expect(endpoint.type).toEqual('HostServiceEndpoint');
expect(endpoint.context).toEqual(context);
expect(endpoint.locations[0]).toEqual(location);
});
it('should serialize HostServiceEndpoint', () => {
const serviceEndpointStr = JSON.stringify(endpoint);
expect(serviceEndpointStr).toEqual(mockServiceEndpointStr);
});
it('should deserialize HostServiceEndpoint', () => {
const serviceEndpoint = HostServiceEndpoint_1.default.fromJSON(JSON.parse(mockServiceEndpointStr));
console.log(serviceEndpoint);
expect(serviceEndpoint).toEqual(endpoint);
});
});
//# sourceMappingURL=HostServiceEndpoint.spec.js.map