From e6db4c192d7a405c789a997c2aeebe2f40621948 Mon Sep 17 00:00:00 2001 From: Reece Dunham Date: Thu, 25 Jul 2024 12:11:48 -0400 Subject: [PATCH 1/2] style: formatting --- tests/handleEvent.spec.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tests/handleEvent.spec.ts b/tests/handleEvent.spec.ts index a77fee8..b1d5480 100644 --- a/tests/handleEvent.spec.ts +++ b/tests/handleEvent.spec.ts @@ -209,14 +209,22 @@ describe("handleEvent api", () => { it("supports $.ContractId", () => { const { Definition, Input } = suites.withContractId - const result = handleEvent(Definition, Definition.Context, Input.Value, { - currentState: "Start", - eventName: Input.Name, - timestamp: 0, - contractId: "abc123", - }) + const result = handleEvent( + Definition, + Definition.Context, + Input.Value, + { + currentState: "Start", + eventName: Input.Name, + timestamp: 0, + contractId: "abc123", + }, + ) - assert.ok(!result.context["ContractId"], "ContractId should not be in the context after the event") + assert.ok( + !result.context["ContractId"], + "ContractId should not be in the context after the event", + ) assert.strictEqual(result.state, "Success") }) }) From ca8402e70fa3de877b8d70d91b6684f666ddcd1d Mon Sep 17 00:00:00 2001 From: Reece Dunham Date: Thu, 25 Jul 2024 12:12:18 -0400 Subject: [PATCH 2/2] Revert "fix: remaining usages of hasOwnProperty" This reverts commit b9f0b47d41cd47572655826517538a1edfe4e3d5. --- src/utils.ts | 2 +- tests/handleEvent.data.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 081ad7b..03d7780 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -141,7 +141,7 @@ export function findNamedChild( let obj = variables // if we have a global matching the exact name of the reference, this is probably what we want - if (obj[reference]) { + if (Object.prototype.hasOwnProperty.call(obj, reference)) { return obj[reference] } diff --git a/tests/handleEvent.data.json b/tests/handleEvent.data.json index c487d41..8f1b349 100644 --- a/tests/handleEvent.data.json +++ b/tests/handleEvent.data.json @@ -266,7 +266,7 @@ "ContractStarted": { "Condition": { "$eq": [ - "$ContractId", + "$.ContractId", "abc123" ] },