botbuilder-stdlib
Advanced tools
Comparing version 4.12.0-dev-20210112.d086640ffcc0 to 4.12.0-dev-20210113.252531097085
@@ -13,9 +13,2 @@ import { Newable } from './types'; | ||
export declare function assertCondition(condition: unknown, message: string, ctor?: NewableError): void; | ||
/** | ||
* Executes `block` and ensures it throws an exception with `message` | ||
* | ||
* @param {(...args: any[]) => any} block a function that should throw | ||
* @param {string} message expected error message | ||
*/ | ||
export declare function throwsMessage(block: (...args: unknown[]) => unknown, message: string): void; | ||
//# sourceMappingURL=assertExt.d.ts.map |
@@ -11,9 +11,2 @@ import { Newable } from './types'; | ||
export declare function assertCondition(condition: unknown, message: string, ctor?: NewableError): asserts condition; | ||
/** | ||
* Executes `block` and ensures it throws an exception with `message` | ||
* | ||
* @param {(...args: any[]) => any} block a function that should throw | ||
* @param {string} message expected error message | ||
*/ | ||
export declare function throwsMessage(block: (...args: unknown[]) => unknown, message: string): void; | ||
//# sourceMappingURL=assertExt.d.ts.map |
"use strict"; | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.throwsMessage = exports.assertCondition = void 0; | ||
const assert_1 = __importDefault(require("assert")); | ||
const types_1 = require("./types"); | ||
exports.assertCondition = void 0; | ||
/** | ||
@@ -24,20 +19,2 @@ * Asserts `condition` to the Typescript compiler | ||
exports.assertCondition = assertCondition; | ||
/** | ||
* Executes `block` and ensures it throws an exception with `message` | ||
* | ||
* @param {(...args: any[]) => any} block a function that should throw | ||
* @param {string} message expected error message | ||
*/ | ||
function throwsMessage(block, message) { | ||
try { | ||
block(); | ||
} | ||
catch (err) { | ||
assertCondition(types_1.tests.isError(err), 'expected block to throw an Error'); | ||
assert_1.default.strictEqual(err.message, message); | ||
return; | ||
} | ||
throw new Error('promise did not throw'); | ||
} | ||
exports.throwsMessage = throwsMessage; | ||
//# sourceMappingURL=assertExt.js.map |
@@ -5,3 +5,3 @@ { | ||
"description": "BotBuilder shared libraries, internal only", | ||
"version": "4.12.0-dev-20210112.d086640ffcc0", | ||
"version": "4.12.0-dev-20210113.252531097085", | ||
"internal": true, | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
import assert from 'assert'; | ||
import { Newable, tests } from './types'; | ||
import { Newable } from './types'; | ||
@@ -22,19 +21,1 @@ // Represents an error constructor | ||
} | ||
/** | ||
* Executes `block` and ensures it throws an exception with `message` | ||
* | ||
* @param {(...args: any[]) => any} block a function that should throw | ||
* @param {string} message expected error message | ||
*/ | ||
export function throwsMessage(block: (...args: unknown[]) => unknown, message: string): void { | ||
try { | ||
block(); | ||
} catch (err) { | ||
assertCondition(tests.isError(err), 'expected block to throw an Error'); | ||
assert.strictEqual(err.message, message); | ||
return; | ||
} | ||
throw new Error('promise did not throw'); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97612
2346