Skip to content

Commit

Permalink
fix: all assert assertion methods should use assertHarness()
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttj committed Mar 8, 2020
1 parent 822a682 commit 3827c10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scottjarvis/tea",
"version": "1.0.3",
"version": "1.0.4",
"description": "Test Environment Application",
"author": "sc0ttj",
"license": "MIT",
Expand Down
16 changes: 12 additions & 4 deletions src/tea.js
Original file line number Diff line number Diff line change
Expand Up @@ -500,21 +500,29 @@ 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 &&
object.$$typeof === tea.REACT_ELEMENT_TYPE
)
}

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/
Expand Down

0 comments on commit 3827c10

Please sign in to comment.