UNPKG

@apistudio/apim-cli

Version:

CLI for API Management Products

43 lines (30 loc) 940 B
/** * Copyright Super iPaaS Integration LLC, an IBM Company 2024 */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { getRefsFromPlanAsset } from './plan-kind-helper.js'; import { BaseAsset } from '../../../model/assets-model.js'; jest.mock('../../common/message-helper.js', () => ({ showWarning: jest.fn(), })); describe('getRefsFromPlanAsset', () => { beforeEach(() => { jest.clearAllMocks(); }); it('should handle package asset with missing spec properties', () => { const planAsset: BaseAsset = { spec: {}, } as unknown as BaseAsset; const result = getRefsFromPlanAsset(planAsset); expect(result).toEqual([]); }); it('should return empty array when packageAsset exists but lacks a $ref', () => { const packageAsset: BaseAsset = { spec: { qos : {} }, } as unknown as BaseAsset; const result = getRefsFromPlanAsset(packageAsset); expect(result).toEqual([]); }); });