UNPKG

apibuilder-js

Version:

A reference implementation of API Builder for JavaScript

17 lines (15 loc) 662 B
import { ApiBuilderService } from '../../src'; import apidocApi from '../fixtures/apidocApi'; describe('ApiBuilderOperation', () => { describe('#getResponseTypeByCode', () => { test('returns type matching response code', () => { const service = new ApiBuilderService(apidocApi); const resource = service.resources .find((_) => _.typeName === 'application'); const operation = resource?.operations .find((_) => _.path === '/:orgKey' && _.method === 'GET'); const type = operation?.getResponseTypeByCode(200); expect(type?.toString()).toEqual('[com.bryzek.apidoc.api.v0.models.application]'); }); }); });