UNPKG

@shko.online/componentframework-mock

Version:

Mocking library to help with testing PowerApps Component Framework Components

20 lines (19 loc) 722 B
/* Copyright (c) 2022 Betim Beja and Shko Online LLC Licensed under the MIT license. */ import { stub } from 'sinon'; export const mockRefreshParameters = mockGenerator => { mockGenerator.RefreshParameters = stub(); mockGenerator.RefreshParameters.callsFake(() => { if (mockGenerator._PendingUpdates.length !== 0) { mockGenerator._PendingUpdates.forEach(update => { mockGenerator.metadata.UpdateValue(update.value, update.table, update.column, update.row); }); mockGenerator._PendingUpdates = []; } Object.getOwnPropertyNames(mockGenerator.context.parameters).forEach(propertyName => { mockGenerator.context._parameters[propertyName]._Refresh(); }); }); };