@shko.online/componentframework-mock
Version:
Mocking library to help with testing PowerApps Component Framework Components
55 lines (53 loc) • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.NavigationMock = void 0;
var _sinon = require("sinon");
/*
Copyright (c) 2022 Betim Beja and Shko Online LLC
Licensed under the MIT license.
*/
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 = (0, _sinon.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 = (0, _sinon.stub)();
this.openConfirmDialog.callsFake((confirmStrings, options) => {
return new Promise(resolve => {
resolve({
confirmed: true
});
});
});
this.openErrorDialog = (0, _sinon.stub)();
this.openFile = (0, _sinon.stub)();
this.openForm = (0, _sinon.stub)();
this.openUrl = (0, _sinon.stub)();
this.openWebResource = (0, _sinon.stub)();
}
}
exports.NavigationMock = NavigationMock;