From 3827c10810e869c8ef2b5db6e942f7e421b94fdf Mon Sep 17 00:00:00 2001 From: Scott J Date: Sun, 8 Mar 2020 23:27:18 +0000 Subject: [PATCH] fix: all `assert` assertion methods should use assertHarness() --- package.json | 2 +- src/tea.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7887d71..bdacf87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@scottjarvis/tea", - "version": "1.0.3", + "version": "1.0.4", "description": "Test Environment Application", "author": "sc0ttj", "license": "MIT", diff --git a/src/tea.js b/src/tea.js index 3d50be2..29d2494 100644 --- a/src/tea.js +++ b/src/tea.js @@ -500,7 +500,7 @@ export default (tea = function() { var hasSymbol = typeof Symbol === "function" && Symbol.for tea.REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7 - tea.assert.isReactElement = function(object) { + tea.isReactElement = function(object) { return ( typeof object === "object" && object !== null && @@ -508,13 +508,21 @@ export default (tea = function() { ) } + tea.assert.isReactElement = function(msg, a, b) { + return tea.assertHarness(tea.isReactElement(a), msg, a, b, "isReactElement") + } + // https://stackoverflow.com/questions/4402272/checking-if-data-is-immutable - tea.assert.isMutable = function(test) { + tea.isMutable = function(test) { return test && (typeof test == "object" || typeof test == "function") } - tea.assert.isImmutable = function(test) { - return !tea.assert.isMutable(test) + tea.assert.isMutable = function(msg, a, b) { + return tea.assertHarness(tea.Mutable(a), msg, a, b, "isMutable") + } + + tea.assert.isImmutable = function(msg, a, b) { + return tea.assertHarness(!tea.Mutable(a), msg, a, b, "isImmutable") } // https://vanillajstoolkit.com/helpers/diff/