From 6e65d0eb72efb4b1a249280102ad8a14f3123cdb Mon Sep 17 00:00:00 2001 From: Scott J Date: Mon, 9 Mar 2020 00:39:00 +0000 Subject: [PATCH] bumped to v1.0.7: - fixes in assertion "actual" and "expected" output - gives clearer output for (im)mutable and truthy/falsey assertions --- examples/simple-tests.js | 4 ++-- package.json | 2 +- src/tea.js | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/simple-tests.js b/examples/simple-tests.js index cd7184e..3d9ed13 100644 --- a/examples/simple-tests.js +++ b/examples/simple-tests.js @@ -54,8 +54,8 @@ test("test using ASSERT, description here", () => { assert.falsey("0 is falsey", 0) assert.falsey("1 is falsey", 1) assert.falsey("null is falsey", null, true) - assert.isMutable("Object is mutable", {foo: 10}, true) - assert.isImmutable("Number is immutable", 99, true) + assert.isMutable("Object is mutable", 10) + assert.isImmutable("Number is immutable", {foo: 99}) }) // diff --git a/package.json b/package.json index 5b13549..147485d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@scottjarvis/tea", - "version": "1.0.6", + "version": "1.0.7", "description": "Test Environment Application", "author": "sc0ttj", "license": "MIT", diff --git a/src/tea.js b/src/tea.js index ef8a65e..a3c9431 100644 --- a/src/tea.js +++ b/src/tea.js @@ -487,11 +487,11 @@ export default (tea = function() { } tea.assert.truthy = function(msg, a, b) { - return tea.assertHarness(!!a, msg, a, b, "Truthy") + return tea.assertHarness(!!a, msg, a, "truthy", "Truthy") } tea.assert.falsey = function(msg, a, b) { - return tea.assertHarness(!a, msg, a, b, "Falsey") + return tea.assertHarness(!a, msg, a, "falsey", "Falsey") } // from: react/packages/shared/ReactSymbols.js @@ -509,7 +509,7 @@ export default (tea = function() { } tea.assert.isReactElement = function(msg, a, b) { - return tea.assertHarness(tea.isReactElement(a), msg, a, b, "isReactElement") + return tea.assertHarness(tea.isReactElement(a), msg, a, 'typeof ReactElement', "isReactElement") } // https://stackoverflow.com/questions/4402272/checking-if-data-is-immutable @@ -518,11 +518,11 @@ export default (tea = function() { } tea.assert.isMutable = function(msg, a, b) { - return tea.assertHarness(tea.isMutable(a), msg, a, b, "isMutable") + return tea.assertHarness(tea.isMutable(a), msg, typeof a, 'mutable object', "isMutable") } tea.assert.isImmutable = function(msg, a, b) { - return tea.assertHarness(tea.isMutable(a) === false, msg, a, b, "isImmutable") + return tea.assertHarness(tea.isMutable(a) === false, msg, typeof a, 'immutable object', "isImmutable") } // https://vanillajstoolkit.com/helpers/diff/