UNPKG

@shko.online/componentframework-mock

Version:

Mocking library to help with testing PowerApps Component Framework Components

27 lines (25 loc) 900 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mockRefreshParameters = void 0; var _sinon = require("sinon"); /* Copyright (c) 2022 Betim Beja and Shko Online LLC Licensed under the MIT license. */ const mockRefreshParameters = mockGenerator => { mockGenerator.RefreshParameters = (0, _sinon.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(); }); }); }; exports.mockRefreshParameters = mockRefreshParameters;