UNPKG

@shko.online/componentframework-mock

Version:

Mocking library to help with testing PowerApps Component Framework Components

48 lines (47 loc) 1.25 kB
/* Copyright (c) 2022 Betim Beja and Shko Online LLC Licensed under the MIT license. */ import { stub } from 'sinon'; export class NavigationMock { constructor() { this.openAlertDialog = void 0; this.openConfirmDialog = void 0; this.openErrorDialog = void 0; this.openFile = void 0; this.openForm = void 0; this.openUrl = void 0; this.openWebResource = void 0; this.openAlertDialog = stub(); const openAlertDialogStringsPromise = new Promise(resolve => { resolve({ text: 'string', confirmButtonLabel: 'string' }); }); const openAlertDialogOptionsPromise = new Promise(resolve => { resolve({ height: 200, width: 200 }); }); this.openAlertDialog.callsFake((alertStrings, options) => { return new Promise(resolve => { resolve(); }); }); this.openConfirmDialog = stub(); this.openConfirmDialog.callsFake((confirmStrings, options) => { return new Promise(resolve => { resolve({ confirmed: true }); }); }); this.openErrorDialog = stub(); this.openFile = stub(); this.openForm = stub(); this.openUrl = stub(); this.openWebResource = stub(); } }