UNPKG

@bitblit/epsilon

Version:

Tiny adapter to simplify building API gateway Lambda APIS

36 lines 2.02 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 router_util_1 = require("./router-util"); const sample_server_components_1 = require("../../sample/sample-server-components"); describe('#routerUtilApplyOpenApiDoc', function () { it('should create a router config from a yaml file', () => __awaiter(this, void 0, void 0, function* () { const inst = yield sample_server_components_1.SampleServerComponents.createSampleEpsilonGlobalHandler('routerUtilApplyOpenApiDoc-jest'); expect(inst.epsilon.modelValidator).toBeTruthy(); expect(inst.epsilon.modelValidator.fetchModel('AccessTokenRequest')).toBeTruthy(); // TODO: move this to its own test const evt = { httpMethod: 'get', path: '/v0/meta/server', requestContext: { stage: 'v0', }, }; const find = yield inst.epsilon.webHandler.findBestMatchingRoute(evt); expect(find).toBeTruthy(); })); it('should reformat a path to match the other library', function () { const inString = '/meta/item/{itemId}'; const outString = router_util_1.RouterUtil.openApiPathToRouteParserPath(inString); expect(outString).toEqual('/meta/item/:itemId'); }); }); //# sourceMappingURL=router-util.spec.js.map