@ephox/bedrock-client
Advanced tools
Comparing version 11.2.1 to 11.3.0
@@ -0,6 +1,11 @@ | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
declare const eq: (expected: any, actual: any, message?: string | (() => string) | undefined) => void; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
declare const throws: (f: () => void, expected?: string | undefined, message?: string | (() => string) | undefined) => void; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
declare const throwsError: (f: () => void, expected?: string | undefined, message?: string | (() => string) | undefined) => void; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
declare const succeeds: (f: () => void, message?: string | (() => string) | undefined) => void; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
declare const fail: (message?: string | (() => string) | undefined) => void; | ||
export { eq, throws, throwsError, succeeds, fail }; |
import { TestLabel } from '@ephox/bedrock-common'; | ||
import * as Compare from '../core/Compare'; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
var eq = function (expected, actual, message) { | ||
var result = Compare.compare(expected, actual); | ||
if (!result.eq) { | ||
throw new Error(TestLabel.asStringOr(message, result.why)); | ||
var error = new Error(TestLabel.asStringOr(message, result.message)); | ||
error.name = 'AssertionError'; | ||
error.actual = actual; | ||
error.expected = expected; | ||
throw error; | ||
} | ||
}; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
var throws = function (f, expected, message) { | ||
@@ -25,2 +31,3 @@ var token = {}; | ||
}; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
var throwsError = function (f, expected, message) { | ||
@@ -42,2 +49,3 @@ var token = {}; | ||
}; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
var succeeds = function (f, message) { | ||
@@ -51,2 +59,3 @@ try { | ||
}; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
var fail = function (message) { | ||
@@ -53,0 +62,0 @@ throw new Error(TestLabel.asStringOr(message, function () { return 'Test failed'; })); |
export interface Comparison { | ||
eq: boolean; | ||
why: () => string; | ||
message: () => string; | ||
} | ||
export declare const compare: (x: any, y: any) => Comparison; |
@@ -13,6 +13,6 @@ import * as Type from './Type'; | ||
var pass = function () { | ||
return ({ eq: true, why: function () { return ''; } }); | ||
return ({ eq: true, why: function () { return ''; }, message: function () { return ''; } }); | ||
}; | ||
var fail = function (why) { | ||
return ({ eq: false, why: why }); | ||
return ({ eq: false, why: why, message: why }); | ||
}; | ||
@@ -111,5 +111,6 @@ var failCompare = function (x, y, prefix) { | ||
eq: result.eq, | ||
why: function () { return result.why() + '\n' + bar + '\n' + JSON.stringify(x) + '\n' + bar + '\n' + JSON.stringify(y) + '\n' + bar + '\n'; } | ||
why: function () { return result.why() + '\n' + bar + '\n' + JSON.stringify(x) + '\n' + bar + '\n' + JSON.stringify(y) + '\n' + bar + '\n'; }, | ||
message: result.why | ||
}; | ||
}; | ||
//# sourceMappingURL=Compare.js.map |
{ | ||
"name": "@ephox/bedrock-client", | ||
"version": "11.2.1", | ||
"version": "11.3.0", | ||
"author": "Tiny Technologies Inc", | ||
@@ -13,3 +13,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@ephox/bedrock-common": "^11.2.1", | ||
"@ephox/bedrock-common": "^11.3.0", | ||
"@ephox/dispute": "^1.0.3" | ||
@@ -28,3 +28,3 @@ }, | ||
}, | ||
"gitHead": "f57be99e8bf8eb5974f98dfb63f56875ff1f9c35" | ||
"gitHead": "de0f274ecaa8b6cb8c5193fa0c9b8b4e3caf1a3e" | ||
} |
import { TestLabel } from '@ephox/bedrock-common'; | ||
import * as Compare from '../core/Compare'; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
const eq = function (expected: any, actual: any, message?: TestLabel): void { | ||
const result = Compare.compare(expected, actual); | ||
if (!result.eq) { | ||
throw new Error(TestLabel.asStringOr(message, result.why)); | ||
const error: any = new Error(TestLabel.asStringOr(message, result.message)); | ||
error.name = 'AssertionError'; | ||
error.actual = actual; | ||
error.expected = expected; | ||
throw error; | ||
} | ||
}; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
const throws = function (f: () => void, expected?: string, message?: TestLabel): void { | ||
@@ -28,2 +34,3 @@ const token = {}; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
const throwsError = function (f: () => void, expected?: string, message?: TestLabel): void { | ||
@@ -46,2 +53,3 @@ const token = {}; | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
const succeeds = function (f: () => void, message?: TestLabel): void { | ||
@@ -55,2 +63,3 @@ try { | ||
/** @deprecated Use chai assertions or the Assert module instead */ | ||
const fail = function (message?: TestLabel): void { | ||
@@ -57,0 +66,0 @@ throw new Error(TestLabel.asStringOr(message, () => 'Test failed')); |
@@ -16,9 +16,10 @@ import * as Type from './Type'; | ||
why: () => string; | ||
message: () => string; | ||
} | ||
const pass = (): Comparison => | ||
({ eq: true, why: () => '' }); | ||
({ eq: true, why: () => '', message: () => '' }); | ||
const fail = (why: () => string): Comparison => | ||
({ eq: false, why }); | ||
({ eq: false, why, message: why }); | ||
@@ -114,4 +115,5 @@ const failCompare = (x: any, y: any, prefix?: string): Comparison => { | ||
eq: result.eq, | ||
why: () => result.why() + '\n' + bar + '\n' + JSON.stringify(x) + '\n' + bar + '\n' + JSON.stringify(y) + '\n' + bar + '\n' | ||
why: () => result.why() + '\n' + bar + '\n' + JSON.stringify(x) + '\n' + bar + '\n' + JSON.stringify(y) + '\n' + bar + '\n', | ||
message: result.why | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45608
790