UNPKG

@shko.online/componentframework-mock

Version:

Mocking library to help with testing PowerApps Component Framework Components

26 lines (25 loc) 650 B
var _class; /* Copyright (c) 2026 Betim Beja and Shko Online LLC Licensed under the MIT license. */ import { stub } from 'sinon'; export class EventsBagMock { constructor() { return new Proxy(this, EventsBagMock.indexedHandler); } } _class = EventsBagMock; EventsBagMock.indexedHandler = { get(target, property) { let targetProperty = target[property]; if (targetProperty === undefined) { targetProperty = stub(); target[property] = targetProperty; targetProperty.callsFake(function () { console.warn(`Event '${property}' was raised!`, arguments); }); } return targetProperty; } };